{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "edc35505-5e2c-4b92-8083-9f2d1e73a3e3",
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import pandas as pd\n",
    "\n",
    "csv_data_path = 'https://raw.githubusercontent.com/turingplanet/pandas-intro/main/public-datasets/country.csv'\n",
    "country_info = pd.read_csv(csv_data_path)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "a61c9043-b0d3-4df6-a134-67e2daf9d73f",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Country</th>\n",
       "      <th>Region</th>\n",
       "      <th>Population</th>\n",
       "      <th>Area (sq. mi.)</th>\n",
       "      <th>Pop. Density (per sq. mi.)</th>\n",
       "      <th>Coastline (coast/area ratio)</th>\n",
       "      <th>Net migration</th>\n",
       "      <th>Infant mortality (per 1000 births)</th>\n",
       "      <th>GDP ($ per capita)</th>\n",
       "      <th>Literacy (%)</th>\n",
       "      <th>Phones (per 1000)</th>\n",
       "      <th>Arable (%)</th>\n",
       "      <th>Crops (%)</th>\n",
       "      <th>Other (%)</th>\n",
       "      <th>Climate</th>\n",
       "      <th>Birthrate</th>\n",
       "      <th>Deathrate</th>\n",
       "      <th>Agriculture</th>\n",
       "      <th>Industry</th>\n",
       "      <th>Service</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Afghanistan</td>\n",
       "      <td>ASIA (EX. NEAR EAST)</td>\n",
       "      <td>31056997</td>\n",
       "      <td>647500</td>\n",
       "      <td>48,0</td>\n",
       "      <td>0,00</td>\n",
       "      <td>23,06</td>\n",
       "      <td>163,07</td>\n",
       "      <td>700.0</td>\n",
       "      <td>36,0</td>\n",
       "      <td>3,2</td>\n",
       "      <td>12,13</td>\n",
       "      <td>0,22</td>\n",
       "      <td>87,65</td>\n",
       "      <td>1</td>\n",
       "      <td>46,6</td>\n",
       "      <td>20,34</td>\n",
       "      <td>0,38</td>\n",
       "      <td>0,24</td>\n",
       "      <td>0,38</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Albania</td>\n",
       "      <td>EASTERN EUROPE</td>\n",
       "      <td>3581655</td>\n",
       "      <td>28748</td>\n",
       "      <td>124,6</td>\n",
       "      <td>1,26</td>\n",
       "      <td>-4,93</td>\n",
       "      <td>21,52</td>\n",
       "      <td>4500.0</td>\n",
       "      <td>86,5</td>\n",
       "      <td>71,2</td>\n",
       "      <td>21,09</td>\n",
       "      <td>4,42</td>\n",
       "      <td>74,49</td>\n",
       "      <td>3</td>\n",
       "      <td>15,11</td>\n",
       "      <td>5,22</td>\n",
       "      <td>0,232</td>\n",
       "      <td>0,188</td>\n",
       "      <td>0,579</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Algeria</td>\n",
       "      <td>NORTHERN AFRICA</td>\n",
       "      <td>32930091</td>\n",
       "      <td>2381740</td>\n",
       "      <td>13,8</td>\n",
       "      <td>0,04</td>\n",
       "      <td>-0,39</td>\n",
       "      <td>31</td>\n",
       "      <td>6000.0</td>\n",
       "      <td>70,0</td>\n",
       "      <td>78,1</td>\n",
       "      <td>3,22</td>\n",
       "      <td>0,25</td>\n",
       "      <td>96,53</td>\n",
       "      <td>1</td>\n",
       "      <td>17,14</td>\n",
       "      <td>4,61</td>\n",
       "      <td>0,101</td>\n",
       "      <td>0,6</td>\n",
       "      <td>0,298</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>American Samoa</td>\n",
       "      <td>OCEANIA</td>\n",
       "      <td>57794</td>\n",
       "      <td>199</td>\n",
       "      <td>290,4</td>\n",
       "      <td>58,29</td>\n",
       "      <td>-20,71</td>\n",
       "      <td>9,27</td>\n",
       "      <td>8000.0</td>\n",
       "      <td>97,0</td>\n",
       "      <td>259,5</td>\n",
       "      <td>10</td>\n",
       "      <td>15</td>\n",
       "      <td>75</td>\n",
       "      <td>2</td>\n",
       "      <td>22,46</td>\n",
       "      <td>3,27</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Andorra</td>\n",
       "      <td>WESTERN EUROPE</td>\n",
       "      <td>71201</td>\n",
       "      <td>468</td>\n",
       "      <td>152,1</td>\n",
       "      <td>0,00</td>\n",
       "      <td>6,6</td>\n",
       "      <td>4,05</td>\n",
       "      <td>19000.0</td>\n",
       "      <td>100,0</td>\n",
       "      <td>497,2</td>\n",
       "      <td>2,22</td>\n",
       "      <td>0</td>\n",
       "      <td>97,78</td>\n",
       "      <td>3</td>\n",
       "      <td>8,71</td>\n",
       "      <td>6,25</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>222</th>\n",
       "      <td>West Bank</td>\n",
       "      <td>NEAR EAST</td>\n",
       "      <td>2460492</td>\n",
       "      <td>5860</td>\n",
       "      <td>419,9</td>\n",
       "      <td>0,00</td>\n",
       "      <td>2,98</td>\n",
       "      <td>19,62</td>\n",
       "      <td>800.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>145,2</td>\n",
       "      <td>16,9</td>\n",
       "      <td>18,97</td>\n",
       "      <td>64,13</td>\n",
       "      <td>3</td>\n",
       "      <td>31,67</td>\n",
       "      <td>3,92</td>\n",
       "      <td>0,09</td>\n",
       "      <td>0,28</td>\n",
       "      <td>0,63</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>223</th>\n",
       "      <td>Western Sahara</td>\n",
       "      <td>NORTHERN AFRICA</td>\n",
       "      <td>273008</td>\n",
       "      <td>266000</td>\n",
       "      <td>1,0</td>\n",
       "      <td>0,42</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0,02</td>\n",
       "      <td>0</td>\n",
       "      <td>99,98</td>\n",
       "      <td>1</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0,4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>224</th>\n",
       "      <td>Yemen</td>\n",
       "      <td>NEAR EAST</td>\n",
       "      <td>21456188</td>\n",
       "      <td>527970</td>\n",
       "      <td>40,6</td>\n",
       "      <td>0,36</td>\n",
       "      <td>0</td>\n",
       "      <td>61,5</td>\n",
       "      <td>800.0</td>\n",
       "      <td>50,2</td>\n",
       "      <td>37,2</td>\n",
       "      <td>2,78</td>\n",
       "      <td>0,24</td>\n",
       "      <td>96,98</td>\n",
       "      <td>1</td>\n",
       "      <td>42,89</td>\n",
       "      <td>8,3</td>\n",
       "      <td>0,135</td>\n",
       "      <td>0,472</td>\n",
       "      <td>0,393</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>225</th>\n",
       "      <td>Zambia</td>\n",
       "      <td>SUB-SAHARAN AFRICA</td>\n",
       "      <td>11502010</td>\n",
       "      <td>752614</td>\n",
       "      <td>15,3</td>\n",
       "      <td>0,00</td>\n",
       "      <td>0</td>\n",
       "      <td>88,29</td>\n",
       "      <td>800.0</td>\n",
       "      <td>80,6</td>\n",
       "      <td>8,2</td>\n",
       "      <td>7,08</td>\n",
       "      <td>0,03</td>\n",
       "      <td>92,9</td>\n",
       "      <td>2</td>\n",
       "      <td>41</td>\n",
       "      <td>19,93</td>\n",
       "      <td>0,22</td>\n",
       "      <td>0,29</td>\n",
       "      <td>0,489</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>226</th>\n",
       "      <td>Zimbabwe</td>\n",
       "      <td>SUB-SAHARAN AFRICA</td>\n",
       "      <td>12236805</td>\n",
       "      <td>390580</td>\n",
       "      <td>31,3</td>\n",
       "      <td>0,00</td>\n",
       "      <td>0</td>\n",
       "      <td>67,69</td>\n",
       "      <td>1900.0</td>\n",
       "      <td>90,7</td>\n",
       "      <td>26,8</td>\n",
       "      <td>8,32</td>\n",
       "      <td>0,34</td>\n",
       "      <td>91,34</td>\n",
       "      <td>2</td>\n",
       "      <td>28,01</td>\n",
       "      <td>21,84</td>\n",
       "      <td>0,179</td>\n",
       "      <td>0,243</td>\n",
       "      <td>0,579</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>227 rows × 20 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "            Country                               Region  Population  \\\n",
       "0       Afghanistan        ASIA (EX. NEAR EAST)             31056997   \n",
       "1           Albania  EASTERN EUROPE                          3581655   \n",
       "2           Algeria  NORTHERN AFRICA                        32930091   \n",
       "3    American Samoa  OCEANIA                                   57794   \n",
       "4           Andorra  WESTERN EUROPE                            71201   \n",
       "..              ...                                  ...         ...   \n",
       "222       West Bank  NEAR EAST                               2460492   \n",
       "223  Western Sahara  NORTHERN AFRICA                          273008   \n",
       "224           Yemen  NEAR EAST                              21456188   \n",
       "225          Zambia  SUB-SAHARAN AFRICA                     11502010   \n",
       "226        Zimbabwe  SUB-SAHARAN AFRICA                     12236805   \n",
       "\n",
       "     Area (sq. mi.) Pop. Density (per sq. mi.) Coastline (coast/area ratio)  \\\n",
       "0            647500                       48,0                         0,00   \n",
       "1             28748                      124,6                         1,26   \n",
       "2           2381740                       13,8                         0,04   \n",
       "3               199                      290,4                        58,29   \n",
       "4               468                      152,1                         0,00   \n",
       "..              ...                        ...                          ...   \n",
       "222            5860                      419,9                         0,00   \n",
       "223          266000                        1,0                         0,42   \n",
       "224          527970                       40,6                         0,36   \n",
       "225          752614                       15,3                         0,00   \n",
       "226          390580                       31,3                         0,00   \n",
       "\n",
       "    Net migration Infant mortality (per 1000 births)  GDP ($ per capita)  \\\n",
       "0           23,06                             163,07               700.0   \n",
       "1           -4,93                              21,52              4500.0   \n",
       "2           -0,39                                 31              6000.0   \n",
       "3          -20,71                               9,27              8000.0   \n",
       "4             6,6                               4,05             19000.0   \n",
       "..            ...                                ...                 ...   \n",
       "222          2,98                              19,62               800.0   \n",
       "223           NaN                                NaN                 NaN   \n",
       "224             0                               61,5               800.0   \n",
       "225             0                              88,29               800.0   \n",
       "226             0                              67,69              1900.0   \n",
       "\n",
       "    Literacy (%) Phones (per 1000) Arable (%) Crops (%) Other (%) Climate  \\\n",
       "0           36,0               3,2      12,13      0,22     87,65       1   \n",
       "1           86,5              71,2      21,09      4,42     74,49       3   \n",
       "2           70,0              78,1       3,22      0,25     96,53       1   \n",
       "3           97,0             259,5         10        15        75       2   \n",
       "4          100,0             497,2       2,22         0     97,78       3   \n",
       "..           ...               ...        ...       ...       ...     ...   \n",
       "222          NaN             145,2       16,9     18,97     64,13       3   \n",
       "223          NaN               NaN       0,02         0     99,98       1   \n",
       "224         50,2              37,2       2,78      0,24     96,98       1   \n",
       "225         80,6               8,2       7,08      0,03      92,9       2   \n",
       "226         90,7              26,8       8,32      0,34     91,34       2   \n",
       "\n",
       "    Birthrate Deathrate Agriculture Industry Service  \n",
       "0        46,6     20,34        0,38     0,24    0,38  \n",
       "1       15,11      5,22       0,232    0,188   0,579  \n",
       "2       17,14      4,61       0,101      0,6   0,298  \n",
       "3       22,46      3,27         NaN      NaN     NaN  \n",
       "4        8,71      6,25         NaN      NaN     NaN  \n",
       "..        ...       ...         ...      ...     ...  \n",
       "222     31,67      3,92        0,09     0,28    0,63  \n",
       "223       NaN       NaN         NaN      NaN     0,4  \n",
       "224     42,89       8,3       0,135    0,472   0,393  \n",
       "225        41     19,93        0,22     0,29   0,489  \n",
       "226     28,01     21,84       0,179    0,243   0,579  \n",
       "\n",
       "[227 rows x 20 columns]"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "country_info"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "e239142f-8120-497d-9624-e58492fd3f51",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Country</th>\n",
       "      <th>Population</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Afghanistan</td>\n",
       "      <td>31056997</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Albania</td>\n",
       "      <td>3581655</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Algeria</td>\n",
       "      <td>32930091</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>American Samoa</td>\n",
       "      <td>57794</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Andorra</td>\n",
       "      <td>71201</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>222</th>\n",
       "      <td>West Bank</td>\n",
       "      <td>2460492</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>223</th>\n",
       "      <td>Western Sahara</td>\n",
       "      <td>273008</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>224</th>\n",
       "      <td>Yemen</td>\n",
       "      <td>21456188</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>225</th>\n",
       "      <td>Zambia</td>\n",
       "      <td>11502010</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>226</th>\n",
       "      <td>Zimbabwe</td>\n",
       "      <td>12236805</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>227 rows × 2 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "            Country  Population\n",
       "0       Afghanistan    31056997\n",
       "1           Albania     3581655\n",
       "2           Algeria    32930091\n",
       "3    American Samoa       57794\n",
       "4           Andorra       71201\n",
       "..              ...         ...\n",
       "222       West Bank     2460492\n",
       "223  Western Sahara      273008\n",
       "224           Yemen    21456188\n",
       "225          Zambia    11502010\n",
       "226        Zimbabwe    12236805\n",
       "\n",
       "[227 rows x 2 columns]"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "country_info[['Country', 'Population']]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "4598581a-dcd6-45f9-9ad9-3b61fdd36388",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Country</th>\n",
       "      <th>Region</th>\n",
       "      <th>Population</th>\n",
       "      <th>Area (sq. mi.)</th>\n",
       "      <th>Pop. Density (per sq. mi.)</th>\n",
       "      <th>Coastline (coast/area ratio)</th>\n",
       "      <th>Net migration</th>\n",
       "      <th>Infant mortality (per 1000 births)</th>\n",
       "      <th>GDP ($ per capita)</th>\n",
       "      <th>Literacy (%)</th>\n",
       "      <th>Phones (per 1000)</th>\n",
       "      <th>Arable (%)</th>\n",
       "      <th>Crops (%)</th>\n",
       "      <th>Other (%)</th>\n",
       "      <th>Climate</th>\n",
       "      <th>Birthrate</th>\n",
       "      <th>Deathrate</th>\n",
       "      <th>Agriculture</th>\n",
       "      <th>Industry</th>\n",
       "      <th>Service</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Albania</td>\n",
       "      <td>EASTERN EUROPE</td>\n",
       "      <td>3581655</td>\n",
       "      <td>28748</td>\n",
       "      <td>124,6</td>\n",
       "      <td>1,26</td>\n",
       "      <td>-4,93</td>\n",
       "      <td>21,52</td>\n",
       "      <td>4500.0</td>\n",
       "      <td>86,5</td>\n",
       "      <td>71,2</td>\n",
       "      <td>21,09</td>\n",
       "      <td>4,42</td>\n",
       "      <td>74,49</td>\n",
       "      <td>3</td>\n",
       "      <td>15,11</td>\n",
       "      <td>5,22</td>\n",
       "      <td>0,232</td>\n",
       "      <td>0,188</td>\n",
       "      <td>0,579</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Algeria</td>\n",
       "      <td>NORTHERN AFRICA</td>\n",
       "      <td>32930091</td>\n",
       "      <td>2381740</td>\n",
       "      <td>13,8</td>\n",
       "      <td>0,04</td>\n",
       "      <td>-0,39</td>\n",
       "      <td>31</td>\n",
       "      <td>6000.0</td>\n",
       "      <td>70,0</td>\n",
       "      <td>78,1</td>\n",
       "      <td>3,22</td>\n",
       "      <td>0,25</td>\n",
       "      <td>96,53</td>\n",
       "      <td>1</td>\n",
       "      <td>17,14</td>\n",
       "      <td>4,61</td>\n",
       "      <td>0,101</td>\n",
       "      <td>0,6</td>\n",
       "      <td>0,298</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   Country                               Region  Population  Area (sq. mi.)  \\\n",
       "1  Albania  EASTERN EUROPE                          3581655           28748   \n",
       "2  Algeria  NORTHERN AFRICA                        32930091         2381740   \n",
       "\n",
       "  Pop. Density (per sq. mi.) Coastline (coast/area ratio) Net migration  \\\n",
       "1                      124,6                         1,26         -4,93   \n",
       "2                       13,8                         0,04         -0,39   \n",
       "\n",
       "  Infant mortality (per 1000 births)  GDP ($ per capita) Literacy (%)  \\\n",
       "1                              21,52              4500.0         86,5   \n",
       "2                                 31              6000.0         70,0   \n",
       "\n",
       "  Phones (per 1000) Arable (%) Crops (%) Other (%) Climate Birthrate  \\\n",
       "1              71,2      21,09      4,42     74,49       3     15,11   \n",
       "2              78,1       3,22      0,25     96,53       1     17,14   \n",
       "\n",
       "  Deathrate Agriculture Industry Service  \n",
       "1      5,22       0,232    0,188   0,579  \n",
       "2      4,61       0,101      0,6   0,298  "
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "country_info[1:3]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "e34e1f2e-79ff-44d5-8489-d19f9cb3db82",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Country</th>\n",
       "      <th>Region</th>\n",
       "      <th>Population</th>\n",
       "      <th>Area (sq. mi.)</th>\n",
       "      <th>Pop. Density (per sq. mi.)</th>\n",
       "      <th>Coastline (coast/area ratio)</th>\n",
       "      <th>Net migration</th>\n",
       "      <th>Infant mortality (per 1000 births)</th>\n",
       "      <th>GDP ($ per capita)</th>\n",
       "      <th>Literacy (%)</th>\n",
       "      <th>Phones (per 1000)</th>\n",
       "      <th>Arable (%)</th>\n",
       "      <th>Crops (%)</th>\n",
       "      <th>Other (%)</th>\n",
       "      <th>Climate</th>\n",
       "      <th>Birthrate</th>\n",
       "      <th>Deathrate</th>\n",
       "      <th>Agriculture</th>\n",
       "      <th>Industry</th>\n",
       "      <th>Service</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Afghanistan</td>\n",
       "      <td>ASIA (EX. NEAR EAST)</td>\n",
       "      <td>31056997</td>\n",
       "      <td>647500</td>\n",
       "      <td>48,0</td>\n",
       "      <td>0,00</td>\n",
       "      <td>23,06</td>\n",
       "      <td>163,07</td>\n",
       "      <td>700.0</td>\n",
       "      <td>36,0</td>\n",
       "      <td>3,2</td>\n",
       "      <td>12,13</td>\n",
       "      <td>0,22</td>\n",
       "      <td>87,65</td>\n",
       "      <td>1</td>\n",
       "      <td>46,6</td>\n",
       "      <td>20,34</td>\n",
       "      <td>0,38</td>\n",
       "      <td>0,24</td>\n",
       "      <td>0,38</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Albania</td>\n",
       "      <td>EASTERN EUROPE</td>\n",
       "      <td>3581655</td>\n",
       "      <td>28748</td>\n",
       "      <td>124,6</td>\n",
       "      <td>1,26</td>\n",
       "      <td>-4,93</td>\n",
       "      <td>21,52</td>\n",
       "      <td>4500.0</td>\n",
       "      <td>86,5</td>\n",
       "      <td>71,2</td>\n",
       "      <td>21,09</td>\n",
       "      <td>4,42</td>\n",
       "      <td>74,49</td>\n",
       "      <td>3</td>\n",
       "      <td>15,11</td>\n",
       "      <td>5,22</td>\n",
       "      <td>0,232</td>\n",
       "      <td>0,188</td>\n",
       "      <td>0,579</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Algeria</td>\n",
       "      <td>NORTHERN AFRICA</td>\n",
       "      <td>32930091</td>\n",
       "      <td>2381740</td>\n",
       "      <td>13,8</td>\n",
       "      <td>0,04</td>\n",
       "      <td>-0,39</td>\n",
       "      <td>31</td>\n",
       "      <td>6000.0</td>\n",
       "      <td>70,0</td>\n",
       "      <td>78,1</td>\n",
       "      <td>3,22</td>\n",
       "      <td>0,25</td>\n",
       "      <td>96,53</td>\n",
       "      <td>1</td>\n",
       "      <td>17,14</td>\n",
       "      <td>4,61</td>\n",
       "      <td>0,101</td>\n",
       "      <td>0,6</td>\n",
       "      <td>0,298</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>American Samoa</td>\n",
       "      <td>OCEANIA</td>\n",
       "      <td>57794</td>\n",
       "      <td>199</td>\n",
       "      <td>290,4</td>\n",
       "      <td>58,29</td>\n",
       "      <td>-20,71</td>\n",
       "      <td>9,27</td>\n",
       "      <td>8000.0</td>\n",
       "      <td>97,0</td>\n",
       "      <td>259,5</td>\n",
       "      <td>10</td>\n",
       "      <td>15</td>\n",
       "      <td>75</td>\n",
       "      <td>2</td>\n",
       "      <td>22,46</td>\n",
       "      <td>3,27</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Andorra</td>\n",
       "      <td>WESTERN EUROPE</td>\n",
       "      <td>71201</td>\n",
       "      <td>468</td>\n",
       "      <td>152,1</td>\n",
       "      <td>0,00</td>\n",
       "      <td>6,6</td>\n",
       "      <td>4,05</td>\n",
       "      <td>19000.0</td>\n",
       "      <td>100,0</td>\n",
       "      <td>497,2</td>\n",
       "      <td>2,22</td>\n",
       "      <td>0</td>\n",
       "      <td>97,78</td>\n",
       "      <td>3</td>\n",
       "      <td>8,71</td>\n",
       "      <td>6,25</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>Angola</td>\n",
       "      <td>SUB-SAHARAN AFRICA</td>\n",
       "      <td>12127071</td>\n",
       "      <td>1246700</td>\n",
       "      <td>9,7</td>\n",
       "      <td>0,13</td>\n",
       "      <td>0</td>\n",
       "      <td>191,19</td>\n",
       "      <td>1900.0</td>\n",
       "      <td>42,0</td>\n",
       "      <td>7,8</td>\n",
       "      <td>2,41</td>\n",
       "      <td>0,24</td>\n",
       "      <td>97,35</td>\n",
       "      <td>NaN</td>\n",
       "      <td>45,11</td>\n",
       "      <td>24,2</td>\n",
       "      <td>0,096</td>\n",
       "      <td>0,658</td>\n",
       "      <td>0,246</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>Anguilla</td>\n",
       "      <td>LATIN AMER. &amp; CARIB</td>\n",
       "      <td>13477</td>\n",
       "      <td>102</td>\n",
       "      <td>132,1</td>\n",
       "      <td>59,80</td>\n",
       "      <td>10,76</td>\n",
       "      <td>21,03</td>\n",
       "      <td>8600.0</td>\n",
       "      <td>95,0</td>\n",
       "      <td>460,0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>100</td>\n",
       "      <td>2</td>\n",
       "      <td>14,17</td>\n",
       "      <td>5,34</td>\n",
       "      <td>0,04</td>\n",
       "      <td>0,18</td>\n",
       "      <td>0,78</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>Antigua &amp; Barbuda</td>\n",
       "      <td>LATIN AMER. &amp; CARIB</td>\n",
       "      <td>69108</td>\n",
       "      <td>443</td>\n",
       "      <td>156,0</td>\n",
       "      <td>34,54</td>\n",
       "      <td>-6,15</td>\n",
       "      <td>19,46</td>\n",
       "      <td>11000.0</td>\n",
       "      <td>89,0</td>\n",
       "      <td>549,9</td>\n",
       "      <td>18,18</td>\n",
       "      <td>4,55</td>\n",
       "      <td>77,27</td>\n",
       "      <td>2</td>\n",
       "      <td>16,93</td>\n",
       "      <td>5,37</td>\n",
       "      <td>0,038</td>\n",
       "      <td>0,22</td>\n",
       "      <td>0,743</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>Argentina</td>\n",
       "      <td>LATIN AMER. &amp; CARIB</td>\n",
       "      <td>39921833</td>\n",
       "      <td>2766890</td>\n",
       "      <td>14,4</td>\n",
       "      <td>0,18</td>\n",
       "      <td>0,61</td>\n",
       "      <td>15,18</td>\n",
       "      <td>11200.0</td>\n",
       "      <td>97,1</td>\n",
       "      <td>220,4</td>\n",
       "      <td>12,31</td>\n",
       "      <td>0,48</td>\n",
       "      <td>87,21</td>\n",
       "      <td>3</td>\n",
       "      <td>16,73</td>\n",
       "      <td>7,55</td>\n",
       "      <td>0,095</td>\n",
       "      <td>0,358</td>\n",
       "      <td>0,547</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>Armenia</td>\n",
       "      <td>C.W. OF IND. STATES</td>\n",
       "      <td>2976372</td>\n",
       "      <td>29800</td>\n",
       "      <td>99,9</td>\n",
       "      <td>0,00</td>\n",
       "      <td>-6,47</td>\n",
       "      <td>23,28</td>\n",
       "      <td>3500.0</td>\n",
       "      <td>98,6</td>\n",
       "      <td>195,7</td>\n",
       "      <td>17,55</td>\n",
       "      <td>2,3</td>\n",
       "      <td>80,15</td>\n",
       "      <td>4</td>\n",
       "      <td>12,07</td>\n",
       "      <td>8,23</td>\n",
       "      <td>0,239</td>\n",
       "      <td>0,343</td>\n",
       "      <td>0,418</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "             Country                               Region  Population  \\\n",
       "0        Afghanistan        ASIA (EX. NEAR EAST)             31056997   \n",
       "1            Albania  EASTERN EUROPE                          3581655   \n",
       "2            Algeria  NORTHERN AFRICA                        32930091   \n",
       "3     American Samoa  OCEANIA                                   57794   \n",
       "4            Andorra  WESTERN EUROPE                            71201   \n",
       "5             Angola  SUB-SAHARAN AFRICA                     12127071   \n",
       "6           Anguilla              LATIN AMER. & CARIB           13477   \n",
       "7  Antigua & Barbuda              LATIN AMER. & CARIB           69108   \n",
       "8          Argentina              LATIN AMER. & CARIB        39921833   \n",
       "9            Armenia                 C.W. OF IND. STATES      2976372   \n",
       "\n",
       "   Area (sq. mi.) Pop. Density (per sq. mi.) Coastline (coast/area ratio)  \\\n",
       "0          647500                       48,0                         0,00   \n",
       "1           28748                      124,6                         1,26   \n",
       "2         2381740                       13,8                         0,04   \n",
       "3             199                      290,4                        58,29   \n",
       "4             468                      152,1                         0,00   \n",
       "5         1246700                        9,7                         0,13   \n",
       "6             102                      132,1                        59,80   \n",
       "7             443                      156,0                        34,54   \n",
       "8         2766890                       14,4                         0,18   \n",
       "9           29800                       99,9                         0,00   \n",
       "\n",
       "  Net migration Infant mortality (per 1000 births)  GDP ($ per capita)  \\\n",
       "0         23,06                             163,07               700.0   \n",
       "1         -4,93                              21,52              4500.0   \n",
       "2         -0,39                                 31              6000.0   \n",
       "3        -20,71                               9,27              8000.0   \n",
       "4           6,6                               4,05             19000.0   \n",
       "5             0                             191,19              1900.0   \n",
       "6         10,76                              21,03              8600.0   \n",
       "7         -6,15                              19,46             11000.0   \n",
       "8          0,61                              15,18             11200.0   \n",
       "9         -6,47                              23,28              3500.0   \n",
       "\n",
       "  Literacy (%) Phones (per 1000) Arable (%) Crops (%) Other (%) Climate  \\\n",
       "0         36,0               3,2      12,13      0,22     87,65       1   \n",
       "1         86,5              71,2      21,09      4,42     74,49       3   \n",
       "2         70,0              78,1       3,22      0,25     96,53       1   \n",
       "3         97,0             259,5         10        15        75       2   \n",
       "4        100,0             497,2       2,22         0     97,78       3   \n",
       "5         42,0               7,8       2,41      0,24     97,35     NaN   \n",
       "6         95,0             460,0          0         0       100       2   \n",
       "7         89,0             549,9      18,18      4,55     77,27       2   \n",
       "8         97,1             220,4      12,31      0,48     87,21       3   \n",
       "9         98,6             195,7      17,55       2,3     80,15       4   \n",
       "\n",
       "  Birthrate Deathrate Agriculture Industry Service  \n",
       "0      46,6     20,34        0,38     0,24    0,38  \n",
       "1     15,11      5,22       0,232    0,188   0,579  \n",
       "2     17,14      4,61       0,101      0,6   0,298  \n",
       "3     22,46      3,27         NaN      NaN     NaN  \n",
       "4      8,71      6,25         NaN      NaN     NaN  \n",
       "5     45,11      24,2       0,096    0,658   0,246  \n",
       "6     14,17      5,34        0,04     0,18    0,78  \n",
       "7     16,93      5,37       0,038     0,22   0,743  \n",
       "8     16,73      7,55       0,095    0,358   0,547  \n",
       "9     12,07      8,23       0,239    0,343   0,418  "
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "country_info.iloc[:10]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "50b2bf9d-0bd5-420d-ae8a-7a7bc213eab4",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Country                                                 Afghanistan\n",
       "Region                                ASIA (EX. NEAR EAST)         \n",
       "Population                                                 31056997\n",
       "Area (sq. mi.)                                               647500\n",
       "Pop. Density (per sq. mi.)                                     48,0\n",
       "Coastline (coast/area ratio)                                   0,00\n",
       "Net migration                                                 23,06\n",
       "Infant mortality (per 1000 births)                           163,07\n",
       "GDP ($ per capita)                                              700\n",
       "Literacy (%)                                                   36,0\n",
       "Phones (per 1000)                                               3,2\n",
       "Arable (%)                                                    12,13\n",
       "Crops (%)                                                      0,22\n",
       "Other (%)                                                     87,65\n",
       "Climate                                                           1\n",
       "Birthrate                                                      46,6\n",
       "Deathrate                                                     20,34\n",
       "Agriculture                                                    0,38\n",
       "Industry                                                       0,24\n",
       "Service                                                        0,38\n",
       "Name: 0, dtype: object"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "country_info.loc[0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "0cf954e6-4bc5-4043-9f66-11c0f6ec9907",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Region</th>\n",
       "      <th>Population</th>\n",
       "      <th>Area (sq. mi.)</th>\n",
       "      <th>Pop. Density (per sq. mi.)</th>\n",
       "      <th>Coastline (coast/area ratio)</th>\n",
       "      <th>Net migration</th>\n",
       "      <th>Infant mortality (per 1000 births)</th>\n",
       "      <th>GDP ($ per capita)</th>\n",
       "      <th>Literacy (%)</th>\n",
       "      <th>Phones (per 1000)</th>\n",
       "      <th>Arable (%)</th>\n",
       "      <th>Crops (%)</th>\n",
       "      <th>Other (%)</th>\n",
       "      <th>Climate</th>\n",
       "      <th>Birthrate</th>\n",
       "      <th>Deathrate</th>\n",
       "      <th>Agriculture</th>\n",
       "      <th>Industry</th>\n",
       "      <th>Service</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Country</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>Afghanistan</th>\n",
       "      <td>ASIA (EX. NEAR EAST)</td>\n",
       "      <td>31056997</td>\n",
       "      <td>647500</td>\n",
       "      <td>48,0</td>\n",
       "      <td>0,00</td>\n",
       "      <td>23,06</td>\n",
       "      <td>163,07</td>\n",
       "      <td>700.0</td>\n",
       "      <td>36,0</td>\n",
       "      <td>3,2</td>\n",
       "      <td>12,13</td>\n",
       "      <td>0,22</td>\n",
       "      <td>87,65</td>\n",
       "      <td>1</td>\n",
       "      <td>46,6</td>\n",
       "      <td>20,34</td>\n",
       "      <td>0,38</td>\n",
       "      <td>0,24</td>\n",
       "      <td>0,38</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Albania</th>\n",
       "      <td>EASTERN EUROPE</td>\n",
       "      <td>3581655</td>\n",
       "      <td>28748</td>\n",
       "      <td>124,6</td>\n",
       "      <td>1,26</td>\n",
       "      <td>-4,93</td>\n",
       "      <td>21,52</td>\n",
       "      <td>4500.0</td>\n",
       "      <td>86,5</td>\n",
       "      <td>71,2</td>\n",
       "      <td>21,09</td>\n",
       "      <td>4,42</td>\n",
       "      <td>74,49</td>\n",
       "      <td>3</td>\n",
       "      <td>15,11</td>\n",
       "      <td>5,22</td>\n",
       "      <td>0,232</td>\n",
       "      <td>0,188</td>\n",
       "      <td>0,579</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Algeria</th>\n",
       "      <td>NORTHERN AFRICA</td>\n",
       "      <td>32930091</td>\n",
       "      <td>2381740</td>\n",
       "      <td>13,8</td>\n",
       "      <td>0,04</td>\n",
       "      <td>-0,39</td>\n",
       "      <td>31</td>\n",
       "      <td>6000.0</td>\n",
       "      <td>70,0</td>\n",
       "      <td>78,1</td>\n",
       "      <td>3,22</td>\n",
       "      <td>0,25</td>\n",
       "      <td>96,53</td>\n",
       "      <td>1</td>\n",
       "      <td>17,14</td>\n",
       "      <td>4,61</td>\n",
       "      <td>0,101</td>\n",
       "      <td>0,6</td>\n",
       "      <td>0,298</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>American Samoa</th>\n",
       "      <td>OCEANIA</td>\n",
       "      <td>57794</td>\n",
       "      <td>199</td>\n",
       "      <td>290,4</td>\n",
       "      <td>58,29</td>\n",
       "      <td>-20,71</td>\n",
       "      <td>9,27</td>\n",
       "      <td>8000.0</td>\n",
       "      <td>97,0</td>\n",
       "      <td>259,5</td>\n",
       "      <td>10</td>\n",
       "      <td>15</td>\n",
       "      <td>75</td>\n",
       "      <td>2</td>\n",
       "      <td>22,46</td>\n",
       "      <td>3,27</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Andorra</th>\n",
       "      <td>WESTERN EUROPE</td>\n",
       "      <td>71201</td>\n",
       "      <td>468</td>\n",
       "      <td>152,1</td>\n",
       "      <td>0,00</td>\n",
       "      <td>6,6</td>\n",
       "      <td>4,05</td>\n",
       "      <td>19000.0</td>\n",
       "      <td>100,0</td>\n",
       "      <td>497,2</td>\n",
       "      <td>2,22</td>\n",
       "      <td>0</td>\n",
       "      <td>97,78</td>\n",
       "      <td>3</td>\n",
       "      <td>8,71</td>\n",
       "      <td>6,25</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>West Bank</th>\n",
       "      <td>NEAR EAST</td>\n",
       "      <td>2460492</td>\n",
       "      <td>5860</td>\n",
       "      <td>419,9</td>\n",
       "      <td>0,00</td>\n",
       "      <td>2,98</td>\n",
       "      <td>19,62</td>\n",
       "      <td>800.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>145,2</td>\n",
       "      <td>16,9</td>\n",
       "      <td>18,97</td>\n",
       "      <td>64,13</td>\n",
       "      <td>3</td>\n",
       "      <td>31,67</td>\n",
       "      <td>3,92</td>\n",
       "      <td>0,09</td>\n",
       "      <td>0,28</td>\n",
       "      <td>0,63</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Western Sahara</th>\n",
       "      <td>NORTHERN AFRICA</td>\n",
       "      <td>273008</td>\n",
       "      <td>266000</td>\n",
       "      <td>1,0</td>\n",
       "      <td>0,42</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0,02</td>\n",
       "      <td>0</td>\n",
       "      <td>99,98</td>\n",
       "      <td>1</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0,4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Yemen</th>\n",
       "      <td>NEAR EAST</td>\n",
       "      <td>21456188</td>\n",
       "      <td>527970</td>\n",
       "      <td>40,6</td>\n",
       "      <td>0,36</td>\n",
       "      <td>0</td>\n",
       "      <td>61,5</td>\n",
       "      <td>800.0</td>\n",
       "      <td>50,2</td>\n",
       "      <td>37,2</td>\n",
       "      <td>2,78</td>\n",
       "      <td>0,24</td>\n",
       "      <td>96,98</td>\n",
       "      <td>1</td>\n",
       "      <td>42,89</td>\n",
       "      <td>8,3</td>\n",
       "      <td>0,135</td>\n",
       "      <td>0,472</td>\n",
       "      <td>0,393</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Zambia</th>\n",
       "      <td>SUB-SAHARAN AFRICA</td>\n",
       "      <td>11502010</td>\n",
       "      <td>752614</td>\n",
       "      <td>15,3</td>\n",
       "      <td>0,00</td>\n",
       "      <td>0</td>\n",
       "      <td>88,29</td>\n",
       "      <td>800.0</td>\n",
       "      <td>80,6</td>\n",
       "      <td>8,2</td>\n",
       "      <td>7,08</td>\n",
       "      <td>0,03</td>\n",
       "      <td>92,9</td>\n",
       "      <td>2</td>\n",
       "      <td>41</td>\n",
       "      <td>19,93</td>\n",
       "      <td>0,22</td>\n",
       "      <td>0,29</td>\n",
       "      <td>0,489</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Zimbabwe</th>\n",
       "      <td>SUB-SAHARAN AFRICA</td>\n",
       "      <td>12236805</td>\n",
       "      <td>390580</td>\n",
       "      <td>31,3</td>\n",
       "      <td>0,00</td>\n",
       "      <td>0</td>\n",
       "      <td>67,69</td>\n",
       "      <td>1900.0</td>\n",
       "      <td>90,7</td>\n",
       "      <td>26,8</td>\n",
       "      <td>8,32</td>\n",
       "      <td>0,34</td>\n",
       "      <td>91,34</td>\n",
       "      <td>2</td>\n",
       "      <td>28,01</td>\n",
       "      <td>21,84</td>\n",
       "      <td>0,179</td>\n",
       "      <td>0,243</td>\n",
       "      <td>0,579</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>227 rows × 19 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                                             Region  Population  \\\n",
       "Country                                                           \n",
       "Afghanistan           ASIA (EX. NEAR EAST)             31056997   \n",
       "Albania         EASTERN EUROPE                          3581655   \n",
       "Algeria         NORTHERN AFRICA                        32930091   \n",
       "American Samoa  OCEANIA                                   57794   \n",
       "Andorra         WESTERN EUROPE                            71201   \n",
       "...                                             ...         ...   \n",
       "West Bank       NEAR EAST                               2460492   \n",
       "Western Sahara  NORTHERN AFRICA                          273008   \n",
       "Yemen           NEAR EAST                              21456188   \n",
       "Zambia          SUB-SAHARAN AFRICA                     11502010   \n",
       "Zimbabwe        SUB-SAHARAN AFRICA                     12236805   \n",
       "\n",
       "                Area (sq. mi.) Pop. Density (per sq. mi.)  \\\n",
       "Country                                                     \n",
       "Afghanistan             647500                       48,0   \n",
       "Albania                  28748                      124,6   \n",
       "Algeria                2381740                       13,8   \n",
       "American Samoa             199                      290,4   \n",
       "Andorra                    468                      152,1   \n",
       "...                        ...                        ...   \n",
       "West Bank                 5860                      419,9   \n",
       "Western Sahara          266000                        1,0   \n",
       "Yemen                   527970                       40,6   \n",
       "Zambia                  752614                       15,3   \n",
       "Zimbabwe                390580                       31,3   \n",
       "\n",
       "               Coastline (coast/area ratio) Net migration  \\\n",
       "Country                                                     \n",
       "Afghanistan                            0,00         23,06   \n",
       "Albania                                1,26         -4,93   \n",
       "Algeria                                0,04         -0,39   \n",
       "American Samoa                        58,29        -20,71   \n",
       "Andorra                                0,00           6,6   \n",
       "...                                     ...           ...   \n",
       "West Bank                              0,00          2,98   \n",
       "Western Sahara                         0,42           NaN   \n",
       "Yemen                                  0,36             0   \n",
       "Zambia                                 0,00             0   \n",
       "Zimbabwe                               0,00             0   \n",
       "\n",
       "               Infant mortality (per 1000 births)  GDP ($ per capita)  \\\n",
       "Country                                                                 \n",
       "Afghanistan                                163,07               700.0   \n",
       "Albania                                     21,52              4500.0   \n",
       "Algeria                                        31              6000.0   \n",
       "American Samoa                               9,27              8000.0   \n",
       "Andorra                                      4,05             19000.0   \n",
       "...                                           ...                 ...   \n",
       "West Bank                                   19,62               800.0   \n",
       "Western Sahara                                NaN                 NaN   \n",
       "Yemen                                        61,5               800.0   \n",
       "Zambia                                      88,29               800.0   \n",
       "Zimbabwe                                    67,69              1900.0   \n",
       "\n",
       "               Literacy (%) Phones (per 1000) Arable (%) Crops (%) Other (%)  \\\n",
       "Country                                                                        \n",
       "Afghanistan            36,0               3,2      12,13      0,22     87,65   \n",
       "Albania                86,5              71,2      21,09      4,42     74,49   \n",
       "Algeria                70,0              78,1       3,22      0,25     96,53   \n",
       "American Samoa         97,0             259,5         10        15        75   \n",
       "Andorra               100,0             497,2       2,22         0     97,78   \n",
       "...                     ...               ...        ...       ...       ...   \n",
       "West Bank               NaN             145,2       16,9     18,97     64,13   \n",
       "Western Sahara          NaN               NaN       0,02         0     99,98   \n",
       "Yemen                  50,2              37,2       2,78      0,24     96,98   \n",
       "Zambia                 80,6               8,2       7,08      0,03      92,9   \n",
       "Zimbabwe               90,7              26,8       8,32      0,34     91,34   \n",
       "\n",
       "               Climate Birthrate Deathrate Agriculture Industry Service  \n",
       "Country                                                                  \n",
       "Afghanistan          1      46,6     20,34        0,38     0,24    0,38  \n",
       "Albania              3     15,11      5,22       0,232    0,188   0,579  \n",
       "Algeria              1     17,14      4,61       0,101      0,6   0,298  \n",
       "American Samoa       2     22,46      3,27         NaN      NaN     NaN  \n",
       "Andorra              3      8,71      6,25         NaN      NaN     NaN  \n",
       "...                ...       ...       ...         ...      ...     ...  \n",
       "West Bank            3     31,67      3,92        0,09     0,28    0,63  \n",
       "Western Sahara       1       NaN       NaN         NaN      NaN     0,4  \n",
       "Yemen                1     42,89       8,3       0,135    0,472   0,393  \n",
       "Zambia               2        41     19,93        0,22     0,29   0,489  \n",
       "Zimbabwe             2     28,01     21,84       0,179    0,243   0,579  \n",
       "\n",
       "[227 rows x 19 columns]"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "country_info.set_index('Country')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "addc2b0d-a5ff-4abd-bbc6-e89da03e562b",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "RangeIndex(start=0, stop=227, step=1)"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "country_info.index"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "58448411-e134-434f-b960-bde57ce5de37",
   "metadata": {},
   "outputs": [],
   "source": [
    "country_info.set_index('Country', inplace = True) # 加了 inplace 之后，country_info 的真正index才会被重设\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "450f22e3-f12a-4e9a-abf1-79eda6f4c5da",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Index(['Afghanistan', 'Albania', 'Algeria', 'American Samoa', 'Andorra',\n",
       "       'Angola', 'Anguilla', 'Antigua & Barbuda', 'Argentina', 'Armenia',\n",
       "       ...\n",
       "       'Vanuatu', 'Venezuela', 'Vietnam', 'Virgin Islands',\n",
       "       'Wallis and Futuna', 'West Bank', 'Western Sahara', 'Yemen', 'Zambia',\n",
       "       'Zimbabwe'],\n",
       "      dtype='object', name='Country', length=227)"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "country_info.index"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "3499edf3-39c1-4c20-9a13-4d7cc83c5bb1",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Region        ASIA (EX. NEAR EAST)         \n",
       "Population                       1313973713\n",
       "Name: China, dtype: object"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "country_info.loc['China', ['Region', 'Population']]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "id": "eecc1f95-ebbf-4c3d-babd-7492c8381847",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Region                                ASIA (EX. NEAR EAST)         \n",
       "Population                                                 31056997\n",
       "Area (sq. mi.)                                               647500\n",
       "Pop. Density (per sq. mi.)                                     48,0\n",
       "Coastline (coast/area ratio)                                   0,00\n",
       "Net migration                                                 23,06\n",
       "Infant mortality (per 1000 births)                           163,07\n",
       "GDP ($ per capita)                                              700\n",
       "Literacy (%)                                                   36,0\n",
       "Phones (per 1000)                                               3,2\n",
       "Arable (%)                                                    12,13\n",
       "Crops (%)                                                      0,22\n",
       "Other (%)                                                     87,65\n",
       "Climate                                                           1\n",
       "Birthrate                                                      46,6\n",
       "Deathrate                                                     20,34\n",
       "Agriculture                                                    0,38\n",
       "Industry                                                       0,24\n",
       "Service                                                        0,38\n",
       "Name: Afghanistan, dtype: object"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "country_info.iloc[0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "id": "f946e605-647c-480a-a522-1134a84baefe",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Region</th>\n",
       "      <th>Population</th>\n",
       "      <th>Area (sq. mi.)</th>\n",
       "      <th>Pop. Density (per sq. mi.)</th>\n",
       "      <th>Coastline (coast/area ratio)</th>\n",
       "      <th>Net migration</th>\n",
       "      <th>Infant mortality (per 1000 births)</th>\n",
       "      <th>GDP ($ per capita)</th>\n",
       "      <th>Literacy (%)</th>\n",
       "      <th>Phones (per 1000)</th>\n",
       "      <th>Arable (%)</th>\n",
       "      <th>Crops (%)</th>\n",
       "      <th>Other (%)</th>\n",
       "      <th>Climate</th>\n",
       "      <th>Birthrate</th>\n",
       "      <th>Deathrate</th>\n",
       "      <th>Agriculture</th>\n",
       "      <th>Industry</th>\n",
       "      <th>Service</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Country</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>Zimbabwe</th>\n",
       "      <td>SUB-SAHARAN AFRICA</td>\n",
       "      <td>12236805</td>\n",
       "      <td>390580</td>\n",
       "      <td>31,3</td>\n",
       "      <td>0,00</td>\n",
       "      <td>0</td>\n",
       "      <td>67,69</td>\n",
       "      <td>1900.0</td>\n",
       "      <td>90,7</td>\n",
       "      <td>26,8</td>\n",
       "      <td>8,32</td>\n",
       "      <td>0,34</td>\n",
       "      <td>91,34</td>\n",
       "      <td>2</td>\n",
       "      <td>28,01</td>\n",
       "      <td>21,84</td>\n",
       "      <td>0,179</td>\n",
       "      <td>0,243</td>\n",
       "      <td>0,579</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Zambia</th>\n",
       "      <td>SUB-SAHARAN AFRICA</td>\n",
       "      <td>11502010</td>\n",
       "      <td>752614</td>\n",
       "      <td>15,3</td>\n",
       "      <td>0,00</td>\n",
       "      <td>0</td>\n",
       "      <td>88,29</td>\n",
       "      <td>800.0</td>\n",
       "      <td>80,6</td>\n",
       "      <td>8,2</td>\n",
       "      <td>7,08</td>\n",
       "      <td>0,03</td>\n",
       "      <td>92,9</td>\n",
       "      <td>2</td>\n",
       "      <td>41</td>\n",
       "      <td>19,93</td>\n",
       "      <td>0,22</td>\n",
       "      <td>0,29</td>\n",
       "      <td>0,489</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Yemen</th>\n",
       "      <td>NEAR EAST</td>\n",
       "      <td>21456188</td>\n",
       "      <td>527970</td>\n",
       "      <td>40,6</td>\n",
       "      <td>0,36</td>\n",
       "      <td>0</td>\n",
       "      <td>61,5</td>\n",
       "      <td>800.0</td>\n",
       "      <td>50,2</td>\n",
       "      <td>37,2</td>\n",
       "      <td>2,78</td>\n",
       "      <td>0,24</td>\n",
       "      <td>96,98</td>\n",
       "      <td>1</td>\n",
       "      <td>42,89</td>\n",
       "      <td>8,3</td>\n",
       "      <td>0,135</td>\n",
       "      <td>0,472</td>\n",
       "      <td>0,393</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Western Sahara</th>\n",
       "      <td>NORTHERN AFRICA</td>\n",
       "      <td>273008</td>\n",
       "      <td>266000</td>\n",
       "      <td>1,0</td>\n",
       "      <td>0,42</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0,02</td>\n",
       "      <td>0</td>\n",
       "      <td>99,98</td>\n",
       "      <td>1</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0,4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>West Bank</th>\n",
       "      <td>NEAR EAST</td>\n",
       "      <td>2460492</td>\n",
       "      <td>5860</td>\n",
       "      <td>419,9</td>\n",
       "      <td>0,00</td>\n",
       "      <td>2,98</td>\n",
       "      <td>19,62</td>\n",
       "      <td>800.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>145,2</td>\n",
       "      <td>16,9</td>\n",
       "      <td>18,97</td>\n",
       "      <td>64,13</td>\n",
       "      <td>3</td>\n",
       "      <td>31,67</td>\n",
       "      <td>3,92</td>\n",
       "      <td>0,09</td>\n",
       "      <td>0,28</td>\n",
       "      <td>0,63</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Andorra</th>\n",
       "      <td>WESTERN EUROPE</td>\n",
       "      <td>71201</td>\n",
       "      <td>468</td>\n",
       "      <td>152,1</td>\n",
       "      <td>0,00</td>\n",
       "      <td>6,6</td>\n",
       "      <td>4,05</td>\n",
       "      <td>19000.0</td>\n",
       "      <td>100,0</td>\n",
       "      <td>497,2</td>\n",
       "      <td>2,22</td>\n",
       "      <td>0</td>\n",
       "      <td>97,78</td>\n",
       "      <td>3</td>\n",
       "      <td>8,71</td>\n",
       "      <td>6,25</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>American Samoa</th>\n",
       "      <td>OCEANIA</td>\n",
       "      <td>57794</td>\n",
       "      <td>199</td>\n",
       "      <td>290,4</td>\n",
       "      <td>58,29</td>\n",
       "      <td>-20,71</td>\n",
       "      <td>9,27</td>\n",
       "      <td>8000.0</td>\n",
       "      <td>97,0</td>\n",
       "      <td>259,5</td>\n",
       "      <td>10</td>\n",
       "      <td>15</td>\n",
       "      <td>75</td>\n",
       "      <td>2</td>\n",
       "      <td>22,46</td>\n",
       "      <td>3,27</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Algeria</th>\n",
       "      <td>NORTHERN AFRICA</td>\n",
       "      <td>32930091</td>\n",
       "      <td>2381740</td>\n",
       "      <td>13,8</td>\n",
       "      <td>0,04</td>\n",
       "      <td>-0,39</td>\n",
       "      <td>31</td>\n",
       "      <td>6000.0</td>\n",
       "      <td>70,0</td>\n",
       "      <td>78,1</td>\n",
       "      <td>3,22</td>\n",
       "      <td>0,25</td>\n",
       "      <td>96,53</td>\n",
       "      <td>1</td>\n",
       "      <td>17,14</td>\n",
       "      <td>4,61</td>\n",
       "      <td>0,101</td>\n",
       "      <td>0,6</td>\n",
       "      <td>0,298</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Albania</th>\n",
       "      <td>EASTERN EUROPE</td>\n",
       "      <td>3581655</td>\n",
       "      <td>28748</td>\n",
       "      <td>124,6</td>\n",
       "      <td>1,26</td>\n",
       "      <td>-4,93</td>\n",
       "      <td>21,52</td>\n",
       "      <td>4500.0</td>\n",
       "      <td>86,5</td>\n",
       "      <td>71,2</td>\n",
       "      <td>21,09</td>\n",
       "      <td>4,42</td>\n",
       "      <td>74,49</td>\n",
       "      <td>3</td>\n",
       "      <td>15,11</td>\n",
       "      <td>5,22</td>\n",
       "      <td>0,232</td>\n",
       "      <td>0,188</td>\n",
       "      <td>0,579</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Afghanistan</th>\n",
       "      <td>ASIA (EX. NEAR EAST)</td>\n",
       "      <td>31056997</td>\n",
       "      <td>647500</td>\n",
       "      <td>48,0</td>\n",
       "      <td>0,00</td>\n",
       "      <td>23,06</td>\n",
       "      <td>163,07</td>\n",
       "      <td>700.0</td>\n",
       "      <td>36,0</td>\n",
       "      <td>3,2</td>\n",
       "      <td>12,13</td>\n",
       "      <td>0,22</td>\n",
       "      <td>87,65</td>\n",
       "      <td>1</td>\n",
       "      <td>46,6</td>\n",
       "      <td>20,34</td>\n",
       "      <td>0,38</td>\n",
       "      <td>0,24</td>\n",
       "      <td>0,38</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>227 rows × 19 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                                             Region  Population  \\\n",
       "Country                                                           \n",
       "Zimbabwe        SUB-SAHARAN AFRICA                     12236805   \n",
       "Zambia          SUB-SAHARAN AFRICA                     11502010   \n",
       "Yemen           NEAR EAST                              21456188   \n",
       "Western Sahara  NORTHERN AFRICA                          273008   \n",
       "West Bank       NEAR EAST                               2460492   \n",
       "...                                             ...         ...   \n",
       "Andorra         WESTERN EUROPE                            71201   \n",
       "American Samoa  OCEANIA                                   57794   \n",
       "Algeria         NORTHERN AFRICA                        32930091   \n",
       "Albania         EASTERN EUROPE                          3581655   \n",
       "Afghanistan           ASIA (EX. NEAR EAST)             31056997   \n",
       "\n",
       "                Area (sq. mi.) Pop. Density (per sq. mi.)  \\\n",
       "Country                                                     \n",
       "Zimbabwe                390580                       31,3   \n",
       "Zambia                  752614                       15,3   \n",
       "Yemen                   527970                       40,6   \n",
       "Western Sahara          266000                        1,0   \n",
       "West Bank                 5860                      419,9   \n",
       "...                        ...                        ...   \n",
       "Andorra                    468                      152,1   \n",
       "American Samoa             199                      290,4   \n",
       "Algeria                2381740                       13,8   \n",
       "Albania                  28748                      124,6   \n",
       "Afghanistan             647500                       48,0   \n",
       "\n",
       "               Coastline (coast/area ratio) Net migration  \\\n",
       "Country                                                     \n",
       "Zimbabwe                               0,00             0   \n",
       "Zambia                                 0,00             0   \n",
       "Yemen                                  0,36             0   \n",
       "Western Sahara                         0,42           NaN   \n",
       "West Bank                              0,00          2,98   \n",
       "...                                     ...           ...   \n",
       "Andorra                                0,00           6,6   \n",
       "American Samoa                        58,29        -20,71   \n",
       "Algeria                                0,04         -0,39   \n",
       "Albania                                1,26         -4,93   \n",
       "Afghanistan                            0,00         23,06   \n",
       "\n",
       "               Infant mortality (per 1000 births)  GDP ($ per capita)  \\\n",
       "Country                                                                 \n",
       "Zimbabwe                                    67,69              1900.0   \n",
       "Zambia                                      88,29               800.0   \n",
       "Yemen                                        61,5               800.0   \n",
       "Western Sahara                                NaN                 NaN   \n",
       "West Bank                                   19,62               800.0   \n",
       "...                                           ...                 ...   \n",
       "Andorra                                      4,05             19000.0   \n",
       "American Samoa                               9,27              8000.0   \n",
       "Algeria                                        31              6000.0   \n",
       "Albania                                     21,52              4500.0   \n",
       "Afghanistan                                163,07               700.0   \n",
       "\n",
       "               Literacy (%) Phones (per 1000) Arable (%) Crops (%) Other (%)  \\\n",
       "Country                                                                        \n",
       "Zimbabwe               90,7              26,8       8,32      0,34     91,34   \n",
       "Zambia                 80,6               8,2       7,08      0,03      92,9   \n",
       "Yemen                  50,2              37,2       2,78      0,24     96,98   \n",
       "Western Sahara          NaN               NaN       0,02         0     99,98   \n",
       "West Bank               NaN             145,2       16,9     18,97     64,13   \n",
       "...                     ...               ...        ...       ...       ...   \n",
       "Andorra               100,0             497,2       2,22         0     97,78   \n",
       "American Samoa         97,0             259,5         10        15        75   \n",
       "Algeria                70,0              78,1       3,22      0,25     96,53   \n",
       "Albania                86,5              71,2      21,09      4,42     74,49   \n",
       "Afghanistan            36,0               3,2      12,13      0,22     87,65   \n",
       "\n",
       "               Climate Birthrate Deathrate Agriculture Industry Service  \n",
       "Country                                                                  \n",
       "Zimbabwe             2     28,01     21,84       0,179    0,243   0,579  \n",
       "Zambia               2        41     19,93        0,22     0,29   0,489  \n",
       "Yemen                1     42,89       8,3       0,135    0,472   0,393  \n",
       "Western Sahara       1       NaN       NaN         NaN      NaN     0,4  \n",
       "West Bank            3     31,67      3,92        0,09     0,28    0,63  \n",
       "...                ...       ...       ...         ...      ...     ...  \n",
       "Andorra              3      8,71      6,25         NaN      NaN     NaN  \n",
       "American Samoa       2     22,46      3,27         NaN      NaN     NaN  \n",
       "Algeria              1     17,14      4,61       0,101      0,6   0,298  \n",
       "Albania              3     15,11      5,22       0,232    0,188   0,579  \n",
       "Afghanistan          1      46,6     20,34        0,38     0,24    0,38  \n",
       "\n",
       "[227 rows x 19 columns]"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "country_info.sort_index(ascending = False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "id": "5edf3950-adc7-4421-b85e-f6da82a8b0fe",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Region</th>\n",
       "      <th>Population</th>\n",
       "      <th>Area (sq. mi.)</th>\n",
       "      <th>Pop. Density (per sq. mi.)</th>\n",
       "      <th>Coastline (coast/area ratio)</th>\n",
       "      <th>Net migration</th>\n",
       "      <th>Infant mortality (per 1000 births)</th>\n",
       "      <th>GDP ($ per capita)</th>\n",
       "      <th>Literacy (%)</th>\n",
       "      <th>Phones (per 1000)</th>\n",
       "      <th>Arable (%)</th>\n",
       "      <th>Crops (%)</th>\n",
       "      <th>Other (%)</th>\n",
       "      <th>Climate</th>\n",
       "      <th>Birthrate</th>\n",
       "      <th>Deathrate</th>\n",
       "      <th>Agriculture</th>\n",
       "      <th>Industry</th>\n",
       "      <th>Service</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Country</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>Afghanistan</th>\n",
       "      <td>ASIA (EX. NEAR EAST)</td>\n",
       "      <td>31056997</td>\n",
       "      <td>647500</td>\n",
       "      <td>48,0</td>\n",
       "      <td>0,00</td>\n",
       "      <td>23,06</td>\n",
       "      <td>163,07</td>\n",
       "      <td>700.0</td>\n",
       "      <td>36,0</td>\n",
       "      <td>3,2</td>\n",
       "      <td>12,13</td>\n",
       "      <td>0,22</td>\n",
       "      <td>87,65</td>\n",
       "      <td>1</td>\n",
       "      <td>46,6</td>\n",
       "      <td>20,34</td>\n",
       "      <td>0,38</td>\n",
       "      <td>0,24</td>\n",
       "      <td>0,38</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Albania</th>\n",
       "      <td>EASTERN EUROPE</td>\n",
       "      <td>3581655</td>\n",
       "      <td>28748</td>\n",
       "      <td>124,6</td>\n",
       "      <td>1,26</td>\n",
       "      <td>-4,93</td>\n",
       "      <td>21,52</td>\n",
       "      <td>4500.0</td>\n",
       "      <td>86,5</td>\n",
       "      <td>71,2</td>\n",
       "      <td>21,09</td>\n",
       "      <td>4,42</td>\n",
       "      <td>74,49</td>\n",
       "      <td>3</td>\n",
       "      <td>15,11</td>\n",
       "      <td>5,22</td>\n",
       "      <td>0,232</td>\n",
       "      <td>0,188</td>\n",
       "      <td>0,579</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Algeria</th>\n",
       "      <td>NORTHERN AFRICA</td>\n",
       "      <td>32930091</td>\n",
       "      <td>2381740</td>\n",
       "      <td>13,8</td>\n",
       "      <td>0,04</td>\n",
       "      <td>-0,39</td>\n",
       "      <td>31</td>\n",
       "      <td>6000.0</td>\n",
       "      <td>70,0</td>\n",
       "      <td>78,1</td>\n",
       "      <td>3,22</td>\n",
       "      <td>0,25</td>\n",
       "      <td>96,53</td>\n",
       "      <td>1</td>\n",
       "      <td>17,14</td>\n",
       "      <td>4,61</td>\n",
       "      <td>0,101</td>\n",
       "      <td>0,6</td>\n",
       "      <td>0,298</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>American Samoa</th>\n",
       "      <td>OCEANIA</td>\n",
       "      <td>57794</td>\n",
       "      <td>199</td>\n",
       "      <td>290,4</td>\n",
       "      <td>58,29</td>\n",
       "      <td>-20,71</td>\n",
       "      <td>9,27</td>\n",
       "      <td>8000.0</td>\n",
       "      <td>97,0</td>\n",
       "      <td>259,5</td>\n",
       "      <td>10</td>\n",
       "      <td>15</td>\n",
       "      <td>75</td>\n",
       "      <td>2</td>\n",
       "      <td>22,46</td>\n",
       "      <td>3,27</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Andorra</th>\n",
       "      <td>WESTERN EUROPE</td>\n",
       "      <td>71201</td>\n",
       "      <td>468</td>\n",
       "      <td>152,1</td>\n",
       "      <td>0,00</td>\n",
       "      <td>6,6</td>\n",
       "      <td>4,05</td>\n",
       "      <td>19000.0</td>\n",
       "      <td>100,0</td>\n",
       "      <td>497,2</td>\n",
       "      <td>2,22</td>\n",
       "      <td>0</td>\n",
       "      <td>97,78</td>\n",
       "      <td>3</td>\n",
       "      <td>8,71</td>\n",
       "      <td>6,25</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Virgin Islands</th>\n",
       "      <td>LATIN AMER. &amp; CARIB</td>\n",
       "      <td>108605</td>\n",
       "      <td>1910</td>\n",
       "      <td>56,9</td>\n",
       "      <td>9,84</td>\n",
       "      <td>-8,94</td>\n",
       "      <td>8,03</td>\n",
       "      <td>17200.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>652,8</td>\n",
       "      <td>11,76</td>\n",
       "      <td>2,94</td>\n",
       "      <td>85,3</td>\n",
       "      <td>2</td>\n",
       "      <td>13,96</td>\n",
       "      <td>6,43</td>\n",
       "      <td>0,01</td>\n",
       "      <td>0,19</td>\n",
       "      <td>0,8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Wallis and Futuna</th>\n",
       "      <td>OCEANIA</td>\n",
       "      <td>16025</td>\n",
       "      <td>274</td>\n",
       "      <td>58,5</td>\n",
       "      <td>47,08</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>3700.0</td>\n",
       "      <td>50,0</td>\n",
       "      <td>118,6</td>\n",
       "      <td>5</td>\n",
       "      <td>25</td>\n",
       "      <td>70</td>\n",
       "      <td>2</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>West Bank</th>\n",
       "      <td>NEAR EAST</td>\n",
       "      <td>2460492</td>\n",
       "      <td>5860</td>\n",
       "      <td>419,9</td>\n",
       "      <td>0,00</td>\n",
       "      <td>2,98</td>\n",
       "      <td>19,62</td>\n",
       "      <td>800.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>145,2</td>\n",
       "      <td>16,9</td>\n",
       "      <td>18,97</td>\n",
       "      <td>64,13</td>\n",
       "      <td>3</td>\n",
       "      <td>31,67</td>\n",
       "      <td>3,92</td>\n",
       "      <td>0,09</td>\n",
       "      <td>0,28</td>\n",
       "      <td>0,63</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Western Sahara</th>\n",
       "      <td>NORTHERN AFRICA</td>\n",
       "      <td>273008</td>\n",
       "      <td>266000</td>\n",
       "      <td>1,0</td>\n",
       "      <td>0,42</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0,02</td>\n",
       "      <td>0</td>\n",
       "      <td>99,98</td>\n",
       "      <td>1</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0,4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Zambia</th>\n",
       "      <td>SUB-SAHARAN AFRICA</td>\n",
       "      <td>11502010</td>\n",
       "      <td>752614</td>\n",
       "      <td>15,3</td>\n",
       "      <td>0,00</td>\n",
       "      <td>0</td>\n",
       "      <td>88,29</td>\n",
       "      <td>800.0</td>\n",
       "      <td>80,6</td>\n",
       "      <td>8,2</td>\n",
       "      <td>7,08</td>\n",
       "      <td>0,03</td>\n",
       "      <td>92,9</td>\n",
       "      <td>2</td>\n",
       "      <td>41</td>\n",
       "      <td>19,93</td>\n",
       "      <td>0,22</td>\n",
       "      <td>0,29</td>\n",
       "      <td>0,489</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>225 rows × 19 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                                                Region  Population  \\\n",
       "Country                                                              \n",
       "Afghanistan              ASIA (EX. NEAR EAST)             31056997   \n",
       "Albania            EASTERN EUROPE                          3581655   \n",
       "Algeria            NORTHERN AFRICA                        32930091   \n",
       "American Samoa     OCEANIA                                   57794   \n",
       "Andorra            WESTERN EUROPE                            71201   \n",
       "...                                                ...         ...   \n",
       "Virgin Islands                 LATIN AMER. & CARIB          108605   \n",
       "Wallis and Futuna  OCEANIA                                   16025   \n",
       "West Bank          NEAR EAST                               2460492   \n",
       "Western Sahara     NORTHERN AFRICA                          273008   \n",
       "Zambia             SUB-SAHARAN AFRICA                     11502010   \n",
       "\n",
       "                   Area (sq. mi.) Pop. Density (per sq. mi.)  \\\n",
       "Country                                                        \n",
       "Afghanistan                647500                       48,0   \n",
       "Albania                     28748                      124,6   \n",
       "Algeria                   2381740                       13,8   \n",
       "American Samoa                199                      290,4   \n",
       "Andorra                       468                      152,1   \n",
       "...                           ...                        ...   \n",
       "Virgin Islands               1910                       56,9   \n",
       "Wallis and Futuna             274                       58,5   \n",
       "West Bank                    5860                      419,9   \n",
       "Western Sahara             266000                        1,0   \n",
       "Zambia                     752614                       15,3   \n",
       "\n",
       "                  Coastline (coast/area ratio) Net migration  \\\n",
       "Country                                                        \n",
       "Afghanistan                               0,00         23,06   \n",
       "Albania                                   1,26         -4,93   \n",
       "Algeria                                   0,04         -0,39   \n",
       "American Samoa                           58,29        -20,71   \n",
       "Andorra                                   0,00           6,6   \n",
       "...                                        ...           ...   \n",
       "Virgin Islands                            9,84         -8,94   \n",
       "Wallis and Futuna                        47,08           NaN   \n",
       "West Bank                                 0,00          2,98   \n",
       "Western Sahara                            0,42           NaN   \n",
       "Zambia                                    0,00             0   \n",
       "\n",
       "                  Infant mortality (per 1000 births)  GDP ($ per capita)  \\\n",
       "Country                                                                    \n",
       "Afghanistan                                   163,07               700.0   \n",
       "Albania                                        21,52              4500.0   \n",
       "Algeria                                           31              6000.0   \n",
       "American Samoa                                  9,27              8000.0   \n",
       "Andorra                                         4,05             19000.0   \n",
       "...                                              ...                 ...   \n",
       "Virgin Islands                                  8,03             17200.0   \n",
       "Wallis and Futuna                                NaN              3700.0   \n",
       "West Bank                                      19,62               800.0   \n",
       "Western Sahara                                   NaN                 NaN   \n",
       "Zambia                                         88,29               800.0   \n",
       "\n",
       "                  Literacy (%) Phones (per 1000) Arable (%) Crops (%)  \\\n",
       "Country                                                                 \n",
       "Afghanistan               36,0               3,2      12,13      0,22   \n",
       "Albania                   86,5              71,2      21,09      4,42   \n",
       "Algeria                   70,0              78,1       3,22      0,25   \n",
       "American Samoa            97,0             259,5         10        15   \n",
       "Andorra                  100,0             497,2       2,22         0   \n",
       "...                        ...               ...        ...       ...   \n",
       "Virgin Islands             NaN             652,8      11,76      2,94   \n",
       "Wallis and Futuna         50,0             118,6          5        25   \n",
       "West Bank                  NaN             145,2       16,9     18,97   \n",
       "Western Sahara             NaN               NaN       0,02         0   \n",
       "Zambia                    80,6               8,2       7,08      0,03   \n",
       "\n",
       "                  Other (%) Climate Birthrate Deathrate Agriculture Industry  \\\n",
       "Country                                                                        \n",
       "Afghanistan           87,65       1      46,6     20,34        0,38     0,24   \n",
       "Albania               74,49       3     15,11      5,22       0,232    0,188   \n",
       "Algeria               96,53       1     17,14      4,61       0,101      0,6   \n",
       "American Samoa           75       2     22,46      3,27         NaN      NaN   \n",
       "Andorra               97,78       3      8,71      6,25         NaN      NaN   \n",
       "...                     ...     ...       ...       ...         ...      ...   \n",
       "Virgin Islands         85,3       2     13,96      6,43        0,01     0,19   \n",
       "Wallis and Futuna        70       2       NaN       NaN         NaN      NaN   \n",
       "West Bank             64,13       3     31,67      3,92        0,09     0,28   \n",
       "Western Sahara        99,98       1       NaN       NaN         NaN      NaN   \n",
       "Zambia                 92,9       2        41     19,93        0,22     0,29   \n",
       "\n",
       "                  Service  \n",
       "Country                    \n",
       "Afghanistan          0,38  \n",
       "Albania             0,579  \n",
       "Algeria             0,298  \n",
       "American Samoa        NaN  \n",
       "Andorra               NaN  \n",
       "...                   ...  \n",
       "Virgin Islands        0,8  \n",
       "Wallis and Futuna     NaN  \n",
       "West Bank            0,63  \n",
       "Western Sahara        0,4  \n",
       "Zambia              0,489  \n",
       "\n",
       "[225 rows x 19 columns]"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "country_info.drop(['Zimbabwe', 'Yemen'], axis = 0) # 将国家名为Zimbabwe和Yemen的数据删除掉，axis = 0 代表根据行来定位数据"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "id": "3897f506-80aa-4af6-bbc0-fb9c20869d29",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Area (sq. mi.)</th>\n",
       "      <th>Pop. Density (per sq. mi.)</th>\n",
       "      <th>Coastline (coast/area ratio)</th>\n",
       "      <th>Net migration</th>\n",
       "      <th>Infant mortality (per 1000 births)</th>\n",
       "      <th>GDP ($ per capita)</th>\n",
       "      <th>Literacy (%)</th>\n",
       "      <th>Phones (per 1000)</th>\n",
       "      <th>Arable (%)</th>\n",
       "      <th>Crops (%)</th>\n",
       "      <th>Other (%)</th>\n",
       "      <th>Climate</th>\n",
       "      <th>Birthrate</th>\n",
       "      <th>Deathrate</th>\n",
       "      <th>Agriculture</th>\n",
       "      <th>Industry</th>\n",
       "      <th>Service</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Country</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>Afghanistan</th>\n",
       "      <td>647500</td>\n",
       "      <td>48,0</td>\n",
       "      <td>0,00</td>\n",
       "      <td>23,06</td>\n",
       "      <td>163,07</td>\n",
       "      <td>700.0</td>\n",
       "      <td>36,0</td>\n",
       "      <td>3,2</td>\n",
       "      <td>12,13</td>\n",
       "      <td>0,22</td>\n",
       "      <td>87,65</td>\n",
       "      <td>1</td>\n",
       "      <td>46,6</td>\n",
       "      <td>20,34</td>\n",
       "      <td>0,38</td>\n",
       "      <td>0,24</td>\n",
       "      <td>0,38</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Albania</th>\n",
       "      <td>28748</td>\n",
       "      <td>124,6</td>\n",
       "      <td>1,26</td>\n",
       "      <td>-4,93</td>\n",
       "      <td>21,52</td>\n",
       "      <td>4500.0</td>\n",
       "      <td>86,5</td>\n",
       "      <td>71,2</td>\n",
       "      <td>21,09</td>\n",
       "      <td>4,42</td>\n",
       "      <td>74,49</td>\n",
       "      <td>3</td>\n",
       "      <td>15,11</td>\n",
       "      <td>5,22</td>\n",
       "      <td>0,232</td>\n",
       "      <td>0,188</td>\n",
       "      <td>0,579</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Algeria</th>\n",
       "      <td>2381740</td>\n",
       "      <td>13,8</td>\n",
       "      <td>0,04</td>\n",
       "      <td>-0,39</td>\n",
       "      <td>31</td>\n",
       "      <td>6000.0</td>\n",
       "      <td>70,0</td>\n",
       "      <td>78,1</td>\n",
       "      <td>3,22</td>\n",
       "      <td>0,25</td>\n",
       "      <td>96,53</td>\n",
       "      <td>1</td>\n",
       "      <td>17,14</td>\n",
       "      <td>4,61</td>\n",
       "      <td>0,101</td>\n",
       "      <td>0,6</td>\n",
       "      <td>0,298</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>American Samoa</th>\n",
       "      <td>199</td>\n",
       "      <td>290,4</td>\n",
       "      <td>58,29</td>\n",
       "      <td>-20,71</td>\n",
       "      <td>9,27</td>\n",
       "      <td>8000.0</td>\n",
       "      <td>97,0</td>\n",
       "      <td>259,5</td>\n",
       "      <td>10</td>\n",
       "      <td>15</td>\n",
       "      <td>75</td>\n",
       "      <td>2</td>\n",
       "      <td>22,46</td>\n",
       "      <td>3,27</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Andorra</th>\n",
       "      <td>468</td>\n",
       "      <td>152,1</td>\n",
       "      <td>0,00</td>\n",
       "      <td>6,6</td>\n",
       "      <td>4,05</td>\n",
       "      <td>19000.0</td>\n",
       "      <td>100,0</td>\n",
       "      <td>497,2</td>\n",
       "      <td>2,22</td>\n",
       "      <td>0</td>\n",
       "      <td>97,78</td>\n",
       "      <td>3</td>\n",
       "      <td>8,71</td>\n",
       "      <td>6,25</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>West Bank</th>\n",
       "      <td>5860</td>\n",
       "      <td>419,9</td>\n",
       "      <td>0,00</td>\n",
       "      <td>2,98</td>\n",
       "      <td>19,62</td>\n",
       "      <td>800.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>145,2</td>\n",
       "      <td>16,9</td>\n",
       "      <td>18,97</td>\n",
       "      <td>64,13</td>\n",
       "      <td>3</td>\n",
       "      <td>31,67</td>\n",
       "      <td>3,92</td>\n",
       "      <td>0,09</td>\n",
       "      <td>0,28</td>\n",
       "      <td>0,63</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Western Sahara</th>\n",
       "      <td>266000</td>\n",
       "      <td>1,0</td>\n",
       "      <td>0,42</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0,02</td>\n",
       "      <td>0</td>\n",
       "      <td>99,98</td>\n",
       "      <td>1</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0,4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Yemen</th>\n",
       "      <td>527970</td>\n",
       "      <td>40,6</td>\n",
       "      <td>0,36</td>\n",
       "      <td>0</td>\n",
       "      <td>61,5</td>\n",
       "      <td>800.0</td>\n",
       "      <td>50,2</td>\n",
       "      <td>37,2</td>\n",
       "      <td>2,78</td>\n",
       "      <td>0,24</td>\n",
       "      <td>96,98</td>\n",
       "      <td>1</td>\n",
       "      <td>42,89</td>\n",
       "      <td>8,3</td>\n",
       "      <td>0,135</td>\n",
       "      <td>0,472</td>\n",
       "      <td>0,393</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Zambia</th>\n",
       "      <td>752614</td>\n",
       "      <td>15,3</td>\n",
       "      <td>0,00</td>\n",
       "      <td>0</td>\n",
       "      <td>88,29</td>\n",
       "      <td>800.0</td>\n",
       "      <td>80,6</td>\n",
       "      <td>8,2</td>\n",
       "      <td>7,08</td>\n",
       "      <td>0,03</td>\n",
       "      <td>92,9</td>\n",
       "      <td>2</td>\n",
       "      <td>41</td>\n",
       "      <td>19,93</td>\n",
       "      <td>0,22</td>\n",
       "      <td>0,29</td>\n",
       "      <td>0,489</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Zimbabwe</th>\n",
       "      <td>390580</td>\n",
       "      <td>31,3</td>\n",
       "      <td>0,00</td>\n",
       "      <td>0</td>\n",
       "      <td>67,69</td>\n",
       "      <td>1900.0</td>\n",
       "      <td>90,7</td>\n",
       "      <td>26,8</td>\n",
       "      <td>8,32</td>\n",
       "      <td>0,34</td>\n",
       "      <td>91,34</td>\n",
       "      <td>2</td>\n",
       "      <td>28,01</td>\n",
       "      <td>21,84</td>\n",
       "      <td>0,179</td>\n",
       "      <td>0,243</td>\n",
       "      <td>0,579</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>227 rows × 17 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                Area (sq. mi.) Pop. Density (per sq. mi.)  \\\n",
       "Country                                                     \n",
       "Afghanistan             647500                       48,0   \n",
       "Albania                  28748                      124,6   \n",
       "Algeria                2381740                       13,8   \n",
       "American Samoa             199                      290,4   \n",
       "Andorra                    468                      152,1   \n",
       "...                        ...                        ...   \n",
       "West Bank                 5860                      419,9   \n",
       "Western Sahara          266000                        1,0   \n",
       "Yemen                   527970                       40,6   \n",
       "Zambia                  752614                       15,3   \n",
       "Zimbabwe                390580                       31,3   \n",
       "\n",
       "               Coastline (coast/area ratio) Net migration  \\\n",
       "Country                                                     \n",
       "Afghanistan                            0,00         23,06   \n",
       "Albania                                1,26         -4,93   \n",
       "Algeria                                0,04         -0,39   \n",
       "American Samoa                        58,29        -20,71   \n",
       "Andorra                                0,00           6,6   \n",
       "...                                     ...           ...   \n",
       "West Bank                              0,00          2,98   \n",
       "Western Sahara                         0,42           NaN   \n",
       "Yemen                                  0,36             0   \n",
       "Zambia                                 0,00             0   \n",
       "Zimbabwe                               0,00             0   \n",
       "\n",
       "               Infant mortality (per 1000 births)  GDP ($ per capita)  \\\n",
       "Country                                                                 \n",
       "Afghanistan                                163,07               700.0   \n",
       "Albania                                     21,52              4500.0   \n",
       "Algeria                                        31              6000.0   \n",
       "American Samoa                               9,27              8000.0   \n",
       "Andorra                                      4,05             19000.0   \n",
       "...                                           ...                 ...   \n",
       "West Bank                                   19,62               800.0   \n",
       "Western Sahara                                NaN                 NaN   \n",
       "Yemen                                        61,5               800.0   \n",
       "Zambia                                      88,29               800.0   \n",
       "Zimbabwe                                    67,69              1900.0   \n",
       "\n",
       "               Literacy (%) Phones (per 1000) Arable (%) Crops (%) Other (%)  \\\n",
       "Country                                                                        \n",
       "Afghanistan            36,0               3,2      12,13      0,22     87,65   \n",
       "Albania                86,5              71,2      21,09      4,42     74,49   \n",
       "Algeria                70,0              78,1       3,22      0,25     96,53   \n",
       "American Samoa         97,0             259,5         10        15        75   \n",
       "Andorra               100,0             497,2       2,22         0     97,78   \n",
       "...                     ...               ...        ...       ...       ...   \n",
       "West Bank               NaN             145,2       16,9     18,97     64,13   \n",
       "Western Sahara          NaN               NaN       0,02         0     99,98   \n",
       "Yemen                  50,2              37,2       2,78      0,24     96,98   \n",
       "Zambia                 80,6               8,2       7,08      0,03      92,9   \n",
       "Zimbabwe               90,7              26,8       8,32      0,34     91,34   \n",
       "\n",
       "               Climate Birthrate Deathrate Agriculture Industry Service  \n",
       "Country                                                                  \n",
       "Afghanistan          1      46,6     20,34        0,38     0,24    0,38  \n",
       "Albania              3     15,11      5,22       0,232    0,188   0,579  \n",
       "Algeria              1     17,14      4,61       0,101      0,6   0,298  \n",
       "American Samoa       2     22,46      3,27         NaN      NaN     NaN  \n",
       "Andorra              3      8,71      6,25         NaN      NaN     NaN  \n",
       "...                ...       ...       ...         ...      ...     ...  \n",
       "West Bank            3     31,67      3,92        0,09     0,28    0,63  \n",
       "Western Sahara       1       NaN       NaN         NaN      NaN     0,4  \n",
       "Yemen                1     42,89       8,3       0,135    0,472   0,393  \n",
       "Zambia               2        41     19,93        0,22     0,29   0,489  \n",
       "Zimbabwe             2     28,01     21,84       0,179    0,243   0,579  \n",
       "\n",
       "[227 rows x 17 columns]"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "country_info.drop(['Region', 'Population'], axis = 1) # 将Region和Population两列的数据全部删除，axis = 1 代表根据列来定位数据\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "id": "35232868-0a29-4d06-8f67-e98e812268f1",
   "metadata": {},
   "outputs": [],
   "source": [
    "country_info.reset_index(inplace = True)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "id": "b08e8bf8-fbb8-47c8-93ca-1053d19c69a1",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Country</th>\n",
       "      <th>Region</th>\n",
       "      <th>Population</th>\n",
       "      <th>Area (sq. mi.)</th>\n",
       "      <th>Pop. Density (per sq. mi.)</th>\n",
       "      <th>Coastline (coast/area ratio)</th>\n",
       "      <th>Net migration</th>\n",
       "      <th>Infant mortality (per 1000 births)</th>\n",
       "      <th>GDP ($ per capita)</th>\n",
       "      <th>Literacy (%)</th>\n",
       "      <th>Phones (per 1000)</th>\n",
       "      <th>Arable (%)</th>\n",
       "      <th>Crops (%)</th>\n",
       "      <th>Other (%)</th>\n",
       "      <th>Climate</th>\n",
       "      <th>Birthrate</th>\n",
       "      <th>Deathrate</th>\n",
       "      <th>Agriculture</th>\n",
       "      <th>Industry</th>\n",
       "      <th>Service</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Afghanistan</td>\n",
       "      <td>ASIA (EX. NEAR EAST)</td>\n",
       "      <td>31056997</td>\n",
       "      <td>647500</td>\n",
       "      <td>48,0</td>\n",
       "      <td>0,00</td>\n",
       "      <td>23,06</td>\n",
       "      <td>163,07</td>\n",
       "      <td>700.0</td>\n",
       "      <td>36,0</td>\n",
       "      <td>3,2</td>\n",
       "      <td>12,13</td>\n",
       "      <td>0,22</td>\n",
       "      <td>87,65</td>\n",
       "      <td>1</td>\n",
       "      <td>46,6</td>\n",
       "      <td>20,34</td>\n",
       "      <td>0,38</td>\n",
       "      <td>0,24</td>\n",
       "      <td>0,38</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Albania</td>\n",
       "      <td>EASTERN EUROPE</td>\n",
       "      <td>3581655</td>\n",
       "      <td>28748</td>\n",
       "      <td>124,6</td>\n",
       "      <td>1,26</td>\n",
       "      <td>-4,93</td>\n",
       "      <td>21,52</td>\n",
       "      <td>4500.0</td>\n",
       "      <td>86,5</td>\n",
       "      <td>71,2</td>\n",
       "      <td>21,09</td>\n",
       "      <td>4,42</td>\n",
       "      <td>74,49</td>\n",
       "      <td>3</td>\n",
       "      <td>15,11</td>\n",
       "      <td>5,22</td>\n",
       "      <td>0,232</td>\n",
       "      <td>0,188</td>\n",
       "      <td>0,579</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Algeria</td>\n",
       "      <td>NORTHERN AFRICA</td>\n",
       "      <td>32930091</td>\n",
       "      <td>2381740</td>\n",
       "      <td>13,8</td>\n",
       "      <td>0,04</td>\n",
       "      <td>-0,39</td>\n",
       "      <td>31</td>\n",
       "      <td>6000.0</td>\n",
       "      <td>70,0</td>\n",
       "      <td>78,1</td>\n",
       "      <td>3,22</td>\n",
       "      <td>0,25</td>\n",
       "      <td>96,53</td>\n",
       "      <td>1</td>\n",
       "      <td>17,14</td>\n",
       "      <td>4,61</td>\n",
       "      <td>0,101</td>\n",
       "      <td>0,6</td>\n",
       "      <td>0,298</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>American Samoa</td>\n",
       "      <td>OCEANIA</td>\n",
       "      <td>57794</td>\n",
       "      <td>199</td>\n",
       "      <td>290,4</td>\n",
       "      <td>58,29</td>\n",
       "      <td>-20,71</td>\n",
       "      <td>9,27</td>\n",
       "      <td>8000.0</td>\n",
       "      <td>97,0</td>\n",
       "      <td>259,5</td>\n",
       "      <td>10</td>\n",
       "      <td>15</td>\n",
       "      <td>75</td>\n",
       "      <td>2</td>\n",
       "      <td>22,46</td>\n",
       "      <td>3,27</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Andorra</td>\n",
       "      <td>WESTERN EUROPE</td>\n",
       "      <td>71201</td>\n",
       "      <td>468</td>\n",
       "      <td>152,1</td>\n",
       "      <td>0,00</td>\n",
       "      <td>6,6</td>\n",
       "      <td>4,05</td>\n",
       "      <td>19000.0</td>\n",
       "      <td>100,0</td>\n",
       "      <td>497,2</td>\n",
       "      <td>2,22</td>\n",
       "      <td>0</td>\n",
       "      <td>97,78</td>\n",
       "      <td>3</td>\n",
       "      <td>8,71</td>\n",
       "      <td>6,25</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>222</th>\n",
       "      <td>West Bank</td>\n",
       "      <td>NEAR EAST</td>\n",
       "      <td>2460492</td>\n",
       "      <td>5860</td>\n",
       "      <td>419,9</td>\n",
       "      <td>0,00</td>\n",
       "      <td>2,98</td>\n",
       "      <td>19,62</td>\n",
       "      <td>800.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>145,2</td>\n",
       "      <td>16,9</td>\n",
       "      <td>18,97</td>\n",
       "      <td>64,13</td>\n",
       "      <td>3</td>\n",
       "      <td>31,67</td>\n",
       "      <td>3,92</td>\n",
       "      <td>0,09</td>\n",
       "      <td>0,28</td>\n",
       "      <td>0,63</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>223</th>\n",
       "      <td>Western Sahara</td>\n",
       "      <td>NORTHERN AFRICA</td>\n",
       "      <td>273008</td>\n",
       "      <td>266000</td>\n",
       "      <td>1,0</td>\n",
       "      <td>0,42</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0,02</td>\n",
       "      <td>0</td>\n",
       "      <td>99,98</td>\n",
       "      <td>1</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0,4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>224</th>\n",
       "      <td>Yemen</td>\n",
       "      <td>NEAR EAST</td>\n",
       "      <td>21456188</td>\n",
       "      <td>527970</td>\n",
       "      <td>40,6</td>\n",
       "      <td>0,36</td>\n",
       "      <td>0</td>\n",
       "      <td>61,5</td>\n",
       "      <td>800.0</td>\n",
       "      <td>50,2</td>\n",
       "      <td>37,2</td>\n",
       "      <td>2,78</td>\n",
       "      <td>0,24</td>\n",
       "      <td>96,98</td>\n",
       "      <td>1</td>\n",
       "      <td>42,89</td>\n",
       "      <td>8,3</td>\n",
       "      <td>0,135</td>\n",
       "      <td>0,472</td>\n",
       "      <td>0,393</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>225</th>\n",
       "      <td>Zambia</td>\n",
       "      <td>SUB-SAHARAN AFRICA</td>\n",
       "      <td>11502010</td>\n",
       "      <td>752614</td>\n",
       "      <td>15,3</td>\n",
       "      <td>0,00</td>\n",
       "      <td>0</td>\n",
       "      <td>88,29</td>\n",
       "      <td>800.0</td>\n",
       "      <td>80,6</td>\n",
       "      <td>8,2</td>\n",
       "      <td>7,08</td>\n",
       "      <td>0,03</td>\n",
       "      <td>92,9</td>\n",
       "      <td>2</td>\n",
       "      <td>41</td>\n",
       "      <td>19,93</td>\n",
       "      <td>0,22</td>\n",
       "      <td>0,29</td>\n",
       "      <td>0,489</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>226</th>\n",
       "      <td>Zimbabwe</td>\n",
       "      <td>SUB-SAHARAN AFRICA</td>\n",
       "      <td>12236805</td>\n",
       "      <td>390580</td>\n",
       "      <td>31,3</td>\n",
       "      <td>0,00</td>\n",
       "      <td>0</td>\n",
       "      <td>67,69</td>\n",
       "      <td>1900.0</td>\n",
       "      <td>90,7</td>\n",
       "      <td>26,8</td>\n",
       "      <td>8,32</td>\n",
       "      <td>0,34</td>\n",
       "      <td>91,34</td>\n",
       "      <td>2</td>\n",
       "      <td>28,01</td>\n",
       "      <td>21,84</td>\n",
       "      <td>0,179</td>\n",
       "      <td>0,243</td>\n",
       "      <td>0,579</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>227 rows × 20 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "            Country                               Region  Population  \\\n",
       "0       Afghanistan        ASIA (EX. NEAR EAST)             31056997   \n",
       "1           Albania  EASTERN EUROPE                          3581655   \n",
       "2           Algeria  NORTHERN AFRICA                        32930091   \n",
       "3    American Samoa  OCEANIA                                   57794   \n",
       "4           Andorra  WESTERN EUROPE                            71201   \n",
       "..              ...                                  ...         ...   \n",
       "222       West Bank  NEAR EAST                               2460492   \n",
       "223  Western Sahara  NORTHERN AFRICA                          273008   \n",
       "224           Yemen  NEAR EAST                              21456188   \n",
       "225          Zambia  SUB-SAHARAN AFRICA                     11502010   \n",
       "226        Zimbabwe  SUB-SAHARAN AFRICA                     12236805   \n",
       "\n",
       "     Area (sq. mi.) Pop. Density (per sq. mi.) Coastline (coast/area ratio)  \\\n",
       "0            647500                       48,0                         0,00   \n",
       "1             28748                      124,6                         1,26   \n",
       "2           2381740                       13,8                         0,04   \n",
       "3               199                      290,4                        58,29   \n",
       "4               468                      152,1                         0,00   \n",
       "..              ...                        ...                          ...   \n",
       "222            5860                      419,9                         0,00   \n",
       "223          266000                        1,0                         0,42   \n",
       "224          527970                       40,6                         0,36   \n",
       "225          752614                       15,3                         0,00   \n",
       "226          390580                       31,3                         0,00   \n",
       "\n",
       "    Net migration Infant mortality (per 1000 births)  GDP ($ per capita)  \\\n",
       "0           23,06                             163,07               700.0   \n",
       "1           -4,93                              21,52              4500.0   \n",
       "2           -0,39                                 31              6000.0   \n",
       "3          -20,71                               9,27              8000.0   \n",
       "4             6,6                               4,05             19000.0   \n",
       "..            ...                                ...                 ...   \n",
       "222          2,98                              19,62               800.0   \n",
       "223           NaN                                NaN                 NaN   \n",
       "224             0                               61,5               800.0   \n",
       "225             0                              88,29               800.0   \n",
       "226             0                              67,69              1900.0   \n",
       "\n",
       "    Literacy (%) Phones (per 1000) Arable (%) Crops (%) Other (%) Climate  \\\n",
       "0           36,0               3,2      12,13      0,22     87,65       1   \n",
       "1           86,5              71,2      21,09      4,42     74,49       3   \n",
       "2           70,0              78,1       3,22      0,25     96,53       1   \n",
       "3           97,0             259,5         10        15        75       2   \n",
       "4          100,0             497,2       2,22         0     97,78       3   \n",
       "..           ...               ...        ...       ...       ...     ...   \n",
       "222          NaN             145,2       16,9     18,97     64,13       3   \n",
       "223          NaN               NaN       0,02         0     99,98       1   \n",
       "224         50,2              37,2       2,78      0,24     96,98       1   \n",
       "225         80,6               8,2       7,08      0,03      92,9       2   \n",
       "226         90,7              26,8       8,32      0,34     91,34       2   \n",
       "\n",
       "    Birthrate Deathrate Agriculture Industry Service  \n",
       "0        46,6     20,34        0,38     0,24    0,38  \n",
       "1       15,11      5,22       0,232    0,188   0,579  \n",
       "2       17,14      4,61       0,101      0,6   0,298  \n",
       "3       22,46      3,27         NaN      NaN     NaN  \n",
       "4        8,71      6,25         NaN      NaN     NaN  \n",
       "..        ...       ...         ...      ...     ...  \n",
       "222     31,67      3,92        0,09     0,28    0,63  \n",
       "223       NaN       NaN         NaN      NaN     0,4  \n",
       "224     42,89       8,3       0,135    0,472   0,393  \n",
       "225        41     19,93        0,22     0,29   0,489  \n",
       "226     28,01     21,84       0,179    0,243   0,579  \n",
       "\n",
       "[227 rows x 20 columns]"
      ]
     },
     "execution_count": 23,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "country_info"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "id": "2d9632f3-f8d8-4134-a039-fe758f26e092",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0      False\n",
       "1      False\n",
       "2      False\n",
       "3      False\n",
       "4      False\n",
       "       ...  \n",
       "222    False\n",
       "223    False\n",
       "224     True\n",
       "225     True\n",
       "226     True\n",
       "Name: Net migration, Length: 227, dtype: bool"
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "country_info['Net migration'] == '0' # 返回一个Boolean Series，告知我们哪些国家的净迁移率（Net migration）等于'0'\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "id": "5a04393f-9b98-44da-8d56-478955df2a8e",
   "metadata": {},
   "outputs": [],
   "source": [
    "zero_migration_filter = (country_info['Net migration'] == '0')\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "id": "fb1bd54e-f3a9-4bba-8958-25574b72e0ac",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Country</th>\n",
       "      <th>Region</th>\n",
       "      <th>Population</th>\n",
       "      <th>Area (sq. mi.)</th>\n",
       "      <th>Pop. Density (per sq. mi.)</th>\n",
       "      <th>Coastline (coast/area ratio)</th>\n",
       "      <th>Net migration</th>\n",
       "      <th>Infant mortality (per 1000 births)</th>\n",
       "      <th>GDP ($ per capita)</th>\n",
       "      <th>Literacy (%)</th>\n",
       "      <th>Phones (per 1000)</th>\n",
       "      <th>Arable (%)</th>\n",
       "      <th>Crops (%)</th>\n",
       "      <th>Other (%)</th>\n",
       "      <th>Climate</th>\n",
       "      <th>Birthrate</th>\n",
       "      <th>Deathrate</th>\n",
       "      <th>Agriculture</th>\n",
       "      <th>Industry</th>\n",
       "      <th>Service</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>Angola</td>\n",
       "      <td>SUB-SAHARAN AFRICA</td>\n",
       "      <td>12127071</td>\n",
       "      <td>1246700</td>\n",
       "      <td>9,7</td>\n",
       "      <td>0,13</td>\n",
       "      <td>0</td>\n",
       "      <td>191,19</td>\n",
       "      <td>1900.0</td>\n",
       "      <td>42,0</td>\n",
       "      <td>7,8</td>\n",
       "      <td>2,41</td>\n",
       "      <td>0,24</td>\n",
       "      <td>97,35</td>\n",
       "      <td>NaN</td>\n",
       "      <td>45,11</td>\n",
       "      <td>24,2</td>\n",
       "      <td>0,096</td>\n",
       "      <td>0,658</td>\n",
       "      <td>0,246</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>Aruba</td>\n",
       "      <td>LATIN AMER. &amp; CARIB</td>\n",
       "      <td>71891</td>\n",
       "      <td>193</td>\n",
       "      <td>372,5</td>\n",
       "      <td>35,49</td>\n",
       "      <td>0</td>\n",
       "      <td>5,89</td>\n",
       "      <td>28000.0</td>\n",
       "      <td>97,0</td>\n",
       "      <td>516,1</td>\n",
       "      <td>10,53</td>\n",
       "      <td>0</td>\n",
       "      <td>89,47</td>\n",
       "      <td>2</td>\n",
       "      <td>11,03</td>\n",
       "      <td>6,68</td>\n",
       "      <td>0,004</td>\n",
       "      <td>0,333</td>\n",
       "      <td>0,663</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>Belize</td>\n",
       "      <td>LATIN AMER. &amp; CARIB</td>\n",
       "      <td>287730</td>\n",
       "      <td>22966</td>\n",
       "      <td>12,5</td>\n",
       "      <td>1,68</td>\n",
       "      <td>0</td>\n",
       "      <td>25,69</td>\n",
       "      <td>4900.0</td>\n",
       "      <td>94,1</td>\n",
       "      <td>115,7</td>\n",
       "      <td>2,85</td>\n",
       "      <td>1,71</td>\n",
       "      <td>95,44</td>\n",
       "      <td>2</td>\n",
       "      <td>28,84</td>\n",
       "      <td>5,72</td>\n",
       "      <td>0,142</td>\n",
       "      <td>0,152</td>\n",
       "      <td>0,612</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>Benin</td>\n",
       "      <td>SUB-SAHARAN AFRICA</td>\n",
       "      <td>7862944</td>\n",
       "      <td>112620</td>\n",
       "      <td>69,8</td>\n",
       "      <td>0,11</td>\n",
       "      <td>0</td>\n",
       "      <td>85</td>\n",
       "      <td>1100.0</td>\n",
       "      <td>40,9</td>\n",
       "      <td>9,7</td>\n",
       "      <td>18,08</td>\n",
       "      <td>2,4</td>\n",
       "      <td>79,52</td>\n",
       "      <td>2</td>\n",
       "      <td>38,85</td>\n",
       "      <td>12,22</td>\n",
       "      <td>0,316</td>\n",
       "      <td>0,138</td>\n",
       "      <td>0,546</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>Bhutan</td>\n",
       "      <td>ASIA (EX. NEAR EAST)</td>\n",
       "      <td>2279723</td>\n",
       "      <td>47000</td>\n",
       "      <td>48,5</td>\n",
       "      <td>0,00</td>\n",
       "      <td>0</td>\n",
       "      <td>100,44</td>\n",
       "      <td>1300.0</td>\n",
       "      <td>42,2</td>\n",
       "      <td>14,3</td>\n",
       "      <td>3,09</td>\n",
       "      <td>0,43</td>\n",
       "      <td>96,48</td>\n",
       "      <td>2</td>\n",
       "      <td>33,65</td>\n",
       "      <td>12,7</td>\n",
       "      <td>0,258</td>\n",
       "      <td>0,379</td>\n",
       "      <td>0,363</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>210</th>\n",
       "      <td>Uganda</td>\n",
       "      <td>SUB-SAHARAN AFRICA</td>\n",
       "      <td>28195754</td>\n",
       "      <td>236040</td>\n",
       "      <td>119,5</td>\n",
       "      <td>0,00</td>\n",
       "      <td>0</td>\n",
       "      <td>67,83</td>\n",
       "      <td>1400.0</td>\n",
       "      <td>69,9</td>\n",
       "      <td>3,6</td>\n",
       "      <td>25,88</td>\n",
       "      <td>10,65</td>\n",
       "      <td>63,47</td>\n",
       "      <td>2</td>\n",
       "      <td>47,35</td>\n",
       "      <td>12,24</td>\n",
       "      <td>0,311</td>\n",
       "      <td>0,222</td>\n",
       "      <td>0,469</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>217</th>\n",
       "      <td>Vanuatu</td>\n",
       "      <td>OCEANIA</td>\n",
       "      <td>208869</td>\n",
       "      <td>12200</td>\n",
       "      <td>17,1</td>\n",
       "      <td>20,72</td>\n",
       "      <td>0</td>\n",
       "      <td>55,16</td>\n",
       "      <td>2900.0</td>\n",
       "      <td>53,0</td>\n",
       "      <td>32,6</td>\n",
       "      <td>2,46</td>\n",
       "      <td>7,38</td>\n",
       "      <td>90,16</td>\n",
       "      <td>2</td>\n",
       "      <td>22,72</td>\n",
       "      <td>7,82</td>\n",
       "      <td>0,26</td>\n",
       "      <td>0,12</td>\n",
       "      <td>0,62</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>224</th>\n",
       "      <td>Yemen</td>\n",
       "      <td>NEAR EAST</td>\n",
       "      <td>21456188</td>\n",
       "      <td>527970</td>\n",
       "      <td>40,6</td>\n",
       "      <td>0,36</td>\n",
       "      <td>0</td>\n",
       "      <td>61,5</td>\n",
       "      <td>800.0</td>\n",
       "      <td>50,2</td>\n",
       "      <td>37,2</td>\n",
       "      <td>2,78</td>\n",
       "      <td>0,24</td>\n",
       "      <td>96,98</td>\n",
       "      <td>1</td>\n",
       "      <td>42,89</td>\n",
       "      <td>8,3</td>\n",
       "      <td>0,135</td>\n",
       "      <td>0,472</td>\n",
       "      <td>0,393</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>225</th>\n",
       "      <td>Zambia</td>\n",
       "      <td>SUB-SAHARAN AFRICA</td>\n",
       "      <td>11502010</td>\n",
       "      <td>752614</td>\n",
       "      <td>15,3</td>\n",
       "      <td>0,00</td>\n",
       "      <td>0</td>\n",
       "      <td>88,29</td>\n",
       "      <td>800.0</td>\n",
       "      <td>80,6</td>\n",
       "      <td>8,2</td>\n",
       "      <td>7,08</td>\n",
       "      <td>0,03</td>\n",
       "      <td>92,9</td>\n",
       "      <td>2</td>\n",
       "      <td>41</td>\n",
       "      <td>19,93</td>\n",
       "      <td>0,22</td>\n",
       "      <td>0,29</td>\n",
       "      <td>0,489</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>226</th>\n",
       "      <td>Zimbabwe</td>\n",
       "      <td>SUB-SAHARAN AFRICA</td>\n",
       "      <td>12236805</td>\n",
       "      <td>390580</td>\n",
       "      <td>31,3</td>\n",
       "      <td>0,00</td>\n",
       "      <td>0</td>\n",
       "      <td>67,69</td>\n",
       "      <td>1900.0</td>\n",
       "      <td>90,7</td>\n",
       "      <td>26,8</td>\n",
       "      <td>8,32</td>\n",
       "      <td>0,34</td>\n",
       "      <td>91,34</td>\n",
       "      <td>2</td>\n",
       "      <td>28,01</td>\n",
       "      <td>21,84</td>\n",
       "      <td>0,179</td>\n",
       "      <td>0,243</td>\n",
       "      <td>0,579</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>62 rows × 20 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "      Country                               Region  Population  \\\n",
       "5      Angola  SUB-SAHARAN AFRICA                     12127071   \n",
       "10      Aruba              LATIN AMER. & CARIB           71891   \n",
       "20     Belize              LATIN AMER. & CARIB          287730   \n",
       "21      Benin  SUB-SAHARAN AFRICA                      7862944   \n",
       "23     Bhutan        ASIA (EX. NEAR EAST)              2279723   \n",
       "..        ...                                  ...         ...   \n",
       "210    Uganda  SUB-SAHARAN AFRICA                     28195754   \n",
       "217   Vanuatu  OCEANIA                                  208869   \n",
       "224     Yemen  NEAR EAST                              21456188   \n",
       "225    Zambia  SUB-SAHARAN AFRICA                     11502010   \n",
       "226  Zimbabwe  SUB-SAHARAN AFRICA                     12236805   \n",
       "\n",
       "     Area (sq. mi.) Pop. Density (per sq. mi.) Coastline (coast/area ratio)  \\\n",
       "5           1246700                        9,7                         0,13   \n",
       "10              193                      372,5                        35,49   \n",
       "20            22966                       12,5                         1,68   \n",
       "21           112620                       69,8                         0,11   \n",
       "23            47000                       48,5                         0,00   \n",
       "..              ...                        ...                          ...   \n",
       "210          236040                      119,5                         0,00   \n",
       "217           12200                       17,1                        20,72   \n",
       "224          527970                       40,6                         0,36   \n",
       "225          752614                       15,3                         0,00   \n",
       "226          390580                       31,3                         0,00   \n",
       "\n",
       "    Net migration Infant mortality (per 1000 births)  GDP ($ per capita)  \\\n",
       "5               0                             191,19              1900.0   \n",
       "10              0                               5,89             28000.0   \n",
       "20              0                              25,69              4900.0   \n",
       "21              0                                 85              1100.0   \n",
       "23              0                             100,44              1300.0   \n",
       "..            ...                                ...                 ...   \n",
       "210             0                              67,83              1400.0   \n",
       "217             0                              55,16              2900.0   \n",
       "224             0                               61,5               800.0   \n",
       "225             0                              88,29               800.0   \n",
       "226             0                              67,69              1900.0   \n",
       "\n",
       "    Literacy (%) Phones (per 1000) Arable (%) Crops (%) Other (%) Climate  \\\n",
       "5           42,0               7,8       2,41      0,24     97,35     NaN   \n",
       "10          97,0             516,1      10,53         0     89,47       2   \n",
       "20          94,1             115,7       2,85      1,71     95,44       2   \n",
       "21          40,9               9,7      18,08       2,4     79,52       2   \n",
       "23          42,2              14,3       3,09      0,43     96,48       2   \n",
       "..           ...               ...        ...       ...       ...     ...   \n",
       "210         69,9               3,6      25,88     10,65     63,47       2   \n",
       "217         53,0              32,6       2,46      7,38     90,16       2   \n",
       "224         50,2              37,2       2,78      0,24     96,98       1   \n",
       "225         80,6               8,2       7,08      0,03      92,9       2   \n",
       "226         90,7              26,8       8,32      0,34     91,34       2   \n",
       "\n",
       "    Birthrate Deathrate Agriculture Industry Service  \n",
       "5       45,11      24,2       0,096    0,658   0,246  \n",
       "10      11,03      6,68       0,004    0,333   0,663  \n",
       "20      28,84      5,72       0,142    0,152   0,612  \n",
       "21      38,85     12,22       0,316    0,138   0,546  \n",
       "23      33,65      12,7       0,258    0,379   0,363  \n",
       "..        ...       ...         ...      ...     ...  \n",
       "210     47,35     12,24       0,311    0,222   0,469  \n",
       "217     22,72      7,82        0,26     0,12    0,62  \n",
       "224     42,89       8,3       0,135    0,472   0,393  \n",
       "225        41     19,93        0,22     0,29   0,489  \n",
       "226     28,01     21,84       0,179    0,243   0,579  \n",
       "\n",
       "[62 rows x 20 columns]"
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "country_info[zero_migration_filter] # 获得所有0净迁移率国家的数据\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "id": "a0589198-ae37-4694-accd-6284559d77a7",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Region</th>\n",
       "      <th>Population</th>\n",
       "      <th>Net migration</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>SUB-SAHARAN AFRICA</td>\n",
       "      <td>12127071</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>LATIN AMER. &amp; CARIB</td>\n",
       "      <td>71891</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>LATIN AMER. &amp; CARIB</td>\n",
       "      <td>287730</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>SUB-SAHARAN AFRICA</td>\n",
       "      <td>7862944</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>ASIA (EX. NEAR EAST)</td>\n",
       "      <td>2279723</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>210</th>\n",
       "      <td>SUB-SAHARAN AFRICA</td>\n",
       "      <td>28195754</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>217</th>\n",
       "      <td>OCEANIA</td>\n",
       "      <td>208869</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>224</th>\n",
       "      <td>NEAR EAST</td>\n",
       "      <td>21456188</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>225</th>\n",
       "      <td>SUB-SAHARAN AFRICA</td>\n",
       "      <td>11502010</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>226</th>\n",
       "      <td>SUB-SAHARAN AFRICA</td>\n",
       "      <td>12236805</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>62 rows × 3 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                                  Region  Population Net migration\n",
       "5    SUB-SAHARAN AFRICA                     12127071             0\n",
       "10               LATIN AMER. & CARIB           71891             0\n",
       "20               LATIN AMER. & CARIB          287730             0\n",
       "21   SUB-SAHARAN AFRICA                      7862944             0\n",
       "23         ASIA (EX. NEAR EAST)              2279723             0\n",
       "..                                   ...         ...           ...\n",
       "210  SUB-SAHARAN AFRICA                     28195754             0\n",
       "217  OCEANIA                                  208869             0\n",
       "224  NEAR EAST                              21456188             0\n",
       "225  SUB-SAHARAN AFRICA                     11502010             0\n",
       "226  SUB-SAHARAN AFRICA                     12236805             0\n",
       "\n",
       "[62 rows x 3 columns]"
      ]
     },
     "execution_count": 28,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "country_info.loc[zero_migration_filter, ['Region', 'Population', 'Net migration']] # 只查看0净迁移率国家的Region和Populatino列\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "id": "505b3b60-c26d-4277-9f5f-fc911c3e9fe8",
   "metadata": {},
   "outputs": [],
   "source": [
    "low_migration_filter = (country_info['Net migration'] < '100')\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "id": "58bc61ef-663b-4b83-80fd-50049ae40804",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Region</th>\n",
       "      <th>Population</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>EASTERN EUROPE</td>\n",
       "      <td>3581655</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>NORTHERN AFRICA</td>\n",
       "      <td>32930091</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>OCEANIA</td>\n",
       "      <td>57794</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>SUB-SAHARAN AFRICA</td>\n",
       "      <td>12127071</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>LATIN AMER. &amp; CARIB</td>\n",
       "      <td>13477</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>219</th>\n",
       "      <td>ASIA (EX. NEAR EAST)</td>\n",
       "      <td>84402966</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>220</th>\n",
       "      <td>LATIN AMER. &amp; CARIB</td>\n",
       "      <td>108605</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>224</th>\n",
       "      <td>NEAR EAST</td>\n",
       "      <td>21456188</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>225</th>\n",
       "      <td>SUB-SAHARAN AFRICA</td>\n",
       "      <td>11502010</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>226</th>\n",
       "      <td>SUB-SAHARAN AFRICA</td>\n",
       "      <td>12236805</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>182 rows × 2 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                                  Region  Population\n",
       "1    EASTERN EUROPE                          3581655\n",
       "2    NORTHERN AFRICA                        32930091\n",
       "3    OCEANIA                                   57794\n",
       "5    SUB-SAHARAN AFRICA                     12127071\n",
       "6                LATIN AMER. & CARIB           13477\n",
       "..                                   ...         ...\n",
       "219        ASIA (EX. NEAR EAST)             84402966\n",
       "220              LATIN AMER. & CARIB          108605\n",
       "224  NEAR EAST                              21456188\n",
       "225  SUB-SAHARAN AFRICA                     11502010\n",
       "226  SUB-SAHARAN AFRICA                     12236805\n",
       "\n",
       "[182 rows x 2 columns]"
      ]
     },
     "execution_count": 30,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "country_info.loc[low_migration_filter, ['Region', 'Population']] # 查看净迁移率小于100的国家信息\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "id": "6037362a-ba3d-49bf-9fcc-827edd9a95bb",
   "metadata": {},
   "outputs": [],
   "source": [
    "and_filter = (country_info['Deathrate'] > '1000') & (country_info['Population'] < 10000) # AND条件，同时满足Deathrate大于'1000'，人口小于 10000\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "id": "98b6b1a7-14ae-4b99-b9cc-de5f10e6556b",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "140                LATIN AMER. & CARIB    \n",
       "171    SUB-SAHARAN AFRICA                 \n",
       "174    NORTHERN AMERICA                   \n",
       "Name: Region, dtype: object"
      ]
     },
     "execution_count": 32,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "country_info.loc[and_filter, 'Region'] # 获取满足AND条件国家的Region信息\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "id": "a39a21ef-0da7-487c-8615-c3321fb4a088",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "140                LATIN AMER. & CARIB    \n",
       "171    SUB-SAHARAN AFRICA                 \n",
       "174    NORTHERN AMERICA                   \n",
       "Name: Region, dtype: object"
      ]
     },
     "execution_count": 33,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "country_info.loc[(country_info['Deathrate'] > '1000') & (country_info['Population'] < 10000), 'Region'] # 和以上相同\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "id": "7cac55dd-53f2-4194-ba35-f4ba28c8484c",
   "metadata": {},
   "outputs": [],
   "source": [
    "or_filter = (country_info['Deathrate'] > '1000') | (country_info['Population'] < 10000) # OR条件，满足Deathrate大于'1000'或者'Population'小于10000中任意一个条件，就为True\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "id": "c9fbe7a1-9dfd-4edf-89da-cb5e528bee4b",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0            ASIA (EX. NEAR EAST)         \n",
       "1      EASTERN EUROPE                     \n",
       "2      NORTHERN AFRICA                    \n",
       "3      OCEANIA                            \n",
       "4      WESTERN EUROPE                     \n",
       "                      ...                 \n",
       "220                LATIN AMER. & CARIB    \n",
       "222    NEAR EAST                          \n",
       "224    NEAR EAST                          \n",
       "225    SUB-SAHARAN AFRICA                 \n",
       "226    SUB-SAHARAN AFRICA                 \n",
       "Name: Region, Length: 210, dtype: object"
      ]
     },
     "execution_count": 35,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "country_info.loc[or_filter, 'Region'] # 获取满足OR条件国家的Region信息\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 52,
   "id": "b60499cb-8827-4d25-959e-02a90c15c609",
   "metadata": {},
   "outputs": [],
   "source": [
    "population_filter = (country_info['Population'] > 10000)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 53,
   "id": "e8a9567c-589a-4f33-9da0-3f622eedb0d8",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Region</th>\n",
       "      <th>Deathrate</th>\n",
       "      <th>Population</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>140</th>\n",
       "      <td>LATIN AMER. &amp; CARIB</td>\n",
       "      <td>7,1</td>\n",
       "      <td>9439</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>171</th>\n",
       "      <td>SUB-SAHARAN AFRICA</td>\n",
       "      <td>6,53</td>\n",
       "      <td>7502</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>174</th>\n",
       "      <td>NORTHERN AMERICA</td>\n",
       "      <td>6,83</td>\n",
       "      <td>7026</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                  Region Deathrate  Population\n",
       "140              LATIN AMER. & CARIB           7,1        9439\n",
       "171  SUB-SAHARAN AFRICA                       6,53        7502\n",
       "174  NORTHERN AMERICA                         6,83        7026"
      ]
     },
     "execution_count": 53,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "country_info.loc[~population_filter, ['Region', 'Deathrate', 'Population']]\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 54,
   "id": "fb8d84b4-e073-478f-be0b-d2307855c990",
   "metadata": {},
   "outputs": [],
   "source": [
    "countries = ['China', 'Japan', 'United States', 'India']\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 55,
   "id": "0deb2e59-baa8-44e8-bc9b-37a16819e842",
   "metadata": {},
   "outputs": [],
   "source": [
    "in_filter = country_info['Country'].isin(countries) # 获得国家名是否是在List中的Boolean Series\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 56,
   "id": "1d7b0e08-c5fc-4b67-a745-6d5e9c39c5a9",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Country</th>\n",
       "      <th>Region</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>42</th>\n",
       "      <td>China</td>\n",
       "      <td>ASIA (EX. NEAR EAST)</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>94</th>\n",
       "      <td>India</td>\n",
       "      <td>ASIA (EX. NEAR EAST)</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>103</th>\n",
       "      <td>Japan</td>\n",
       "      <td>ASIA (EX. NEAR EAST)</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>214</th>\n",
       "      <td>United States</td>\n",
       "      <td>NORTHERN AMERICA</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "           Country                               Region\n",
       "42           China        ASIA (EX. NEAR EAST)         \n",
       "94           India        ASIA (EX. NEAR EAST)         \n",
       "103          Japan        ASIA (EX. NEAR EAST)         \n",
       "214  United States  NORTHERN AMERICA                   "
      ]
     },
     "execution_count": 56,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "country_info.loc[in_filter, ['Country', 'Region']] # 获得特定国家的信息\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 57,
   "id": "718712a5-645f-4d85-beb5-de4900a7289b",
   "metadata": {},
   "outputs": [],
   "source": [
    "str_filter = country_info['Country'].str.contains('A')\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 58,
   "id": "152bc5e7-5e87-4f8f-92ea-12d4bf38762f",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "14       Bahamas, The\n",
       "15            Bahrain\n",
       "16         Bangladesh\n",
       "17           Barbados\n",
       "18            Belarus\n",
       "            ...      \n",
       "222         West Bank\n",
       "223    Western Sahara\n",
       "224             Yemen\n",
       "225            Zambia\n",
       "226          Zimbabwe\n",
       "Name: Country, Length: 208, dtype: object"
      ]
     },
     "execution_count": 58,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "country_info.loc[~str_filter, 'Country'] # 获得所有国家名字中不包含字母A的国家名\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 59,
   "id": "bbd88a56-d382-4660-b9d5-82fb3e73eeb9",
   "metadata": {},
   "outputs": [],
   "source": [
    "str_filter2 = country_info['Country'].str.contains('A|Z')\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 61,
   "id": "7f319f9d-67b7-492a-a7cd-fe8f03ec798b",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "14          Bahamas, The\n",
       "15               Bahrain\n",
       "16            Bangladesh\n",
       "17              Barbados\n",
       "18               Belarus\n",
       "             ...        \n",
       "220       Virgin Islands\n",
       "221    Wallis and Futuna\n",
       "222            West Bank\n",
       "223       Western Sahara\n",
       "224                Yemen\n",
       "Name: Country, Length: 205, dtype: object"
      ]
     },
     "execution_count": 61,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "country_info.loc[~str_filter2, 'Country'] # 获得所有国家名字中既不包含A也不包含Z的国家名\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 62,
   "id": "ec871672-246b-4fbc-a423-5ecc97503bab",
   "metadata": {},
   "outputs": [],
   "source": [
    "str_filter3 = country_info['Country'].str.contains('[a-m]')\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 63,
   "id": "b625e675-cbb8-4aea-81a8-b9f4904455ec",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "52    Cyprus\n",
       "Name: Country, dtype: object"
      ]
     },
     "execution_count": 63,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "country_info.loc[~str_filter3, 'Country'] # 获得国家名中不包含小写字母a到m的国家名\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "c0868789-2274-4f15-92e9-0fda9025d33e",
   "metadata": {},
   "outputs": [],
   "source": [
    "请过滤以上的数据集，只获取那些Population大于’10000’并且Climate大于’3’的国家名"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
